ImportCertificate

Updated at:

Imports a certificate file.

Operation description

  1. You must purchase DataWorks Basic Edition or higher to use this feature.

  2. 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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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 ImportCertificateAdvanceRequest.setCertificateFileObject and then call importCertificateAdvance. The SDK applies for an upload location, uploads the certificate to the OSS location specified by the platform, and automatically populates CertificateFile. You do not need to prepare a bucket or a public URL. The following example value shows only the format of the object URL after the upload.

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.