• MapReduce Service

mrs
  1. Help Center
  2. MapReduce Service
  3. API Reference
  4. APIs
  5. Data Source APIs
  6. Creating a Data Source

Creating a Data Source

Function

This API is used to create a data source. This API is compatible with Sahara.

URI

  • Format:

    POST /v1.1/{project_id}/data-sources

  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory or Not

    Description

    project_id

    Yes

    Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

Request

  • Example:
    { 
        "name": "my-data-source",  
        "url": "/simple/mapreduce/input",  
        "is_protected": false,  
        "is_public": false,  
        "type": "hdfs",  
        "description": "this is the data source template" 
    }
  • Parameter description
    Table 2 Request parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    name

    Yes

    String

    Data source name

    Contains 1 to 80 characters and consists of letters, digits, hyphens (-), and underscores (_) only.

    url

    Yes

    String

    Data source URL

    Contains 1 to 255 characters.

    • If the data source type is HDFS, the value is /Save path of the data source.
    • If the data source type is OBS, the value is s3a://Save path of the data source.

    credentials

    No

    Object

    Authentication information

    The current version does not support this function.

    is_protected

    No

    Bool

    Whether the data source is protected

    • true
    • false

    The current version does not support this function.

    is_public

    No

    Bool

    Whether the data source is public

    • true
    • false

    The current version does not support this function.

    type

    Yes

    String

    Data source type

    • HDFS
    • OBS
    • swift (not supported by the current version)

    description

    Yes

    String

    Data source description

    Contains a maximum of 65535 characters.

Response

  • Example:
    {
        "data_source": {
            "name": "my-data-source",
            "type": "hdfs",
            "url": "/simple/mapreduce/input",
            "description": "this is the data source template",
            "created_at": "2017-06-22T08:28:57",
            "updated_at": null,
            "id": "e275a927-fe72-4b8b-a634-e47a11dca181",
            "tenant_id": "5a3314075bfa49b9ae360f4ecd333695",
            "is_public": false,
            "is_protected": false
        }
    }
  • Parameter description
    Table 3 Response parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    description

    Yes

    String

    Data source description

    url

    Yes

    String

    Data source URL

    tenant_id

    Yes

    String

    Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

    created_at

    Yes

    String

    Data source creation time

    updated_at

    Yes

    String

    Data source update time

    is_protected

    No

    Bool

    Whether the data source is protected

    is_public

    No

    Bool

    Whether the data source is public

    type

    Yes

    String

    Data source type

    id

    Yes

    String

    ID returned by the system after the data source is created successfully

    name

    Yes

    String

    Data source name

Status Code

Table 4 describes the status code of this API.

Table 4 Status code

Status Code

Description

202

The data source is successfully created.

For the description about error status codes, see section Status Codes.