CreateDataGrantCommand

This operation creates a data grant.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { DataExchangeClient, CreateDataGrantCommand } from "@aws-sdk/client-dataexchange"; // ES Modules import
// const { DataExchangeClient, CreateDataGrantCommand } = require("@aws-sdk/client-dataexchange"); // CommonJS import
const client = new DataExchangeClient(config);
const input = { // CreateDataGrantRequest
  Name: "STRING_VALUE", // required
  GrantDistributionScope: "STRING_VALUE", // required
  ReceiverPrincipal: "STRING_VALUE", // required
  SourceDataSetId: "STRING_VALUE", // required
  EndsAt: new Date("TIMESTAMP"),
  Description: "STRING_VALUE",
  Tags: { // MapOf__string
    "<keys>": "STRING_VALUE",
  },
};
const command = new CreateDataGrantCommand(input);
const response = await client.send(command);
// { // CreateDataGrantResponse
//   Name: "STRING_VALUE", // required
//   SenderPrincipal: "STRING_VALUE", // required
//   ReceiverPrincipal: "STRING_VALUE", // required
//   Description: "STRING_VALUE",
//   AcceptanceState: "STRING_VALUE", // required
//   AcceptedAt: new Date("TIMESTAMP"),
//   EndsAt: new Date("TIMESTAMP"),
//   GrantDistributionScope: "STRING_VALUE", // required
//   DataSetId: "STRING_VALUE", // required
//   SourceDataSetId: "STRING_VALUE", // required
//   Id: "STRING_VALUE", // required
//   Arn: "STRING_VALUE", // required
//   CreatedAt: new Date("TIMESTAMP"), // required
//   UpdatedAt: new Date("TIMESTAMP"), // required
//   Tags: { // MapOf__string
//     "<keys>": "STRING_VALUE",
//   },
// };

CreateDataGrantCommand Input

See CreateDataGrantCommandInput for more details

Parameter
Type
Description
GrantDistributionScope
Required
GrantDistributionScope | undefined

The distribution scope of the data grant.

Name
Required
string | undefined

The name of the data grant.

ReceiverPrincipal
Required
string | undefined

The Amazon Web Services account ID of the data grant receiver.

SourceDataSetId
Required
string | undefined

The ID of the data set used to create the data grant.

Description
string | undefined

The description of the data grant.

EndsAt
Date | undefined

The timestamp of when access to the associated data set ends.

Tags
Record<string, string> | undefined

The tags to add to the data grant. A tag is a key-value pair.

CreateDataGrantCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
AcceptanceState
Required
DataGrantAcceptanceState | undefined

The acceptance state of the data grant.

Arn
Required
string | undefined

The Amazon Resource Name (ARN) of the data grant.

CreatedAt
Required
Date | undefined

The timestamp of when the data grant was created.

DataSetId
Required
string | undefined

The ID of the data set associated to the data grant.

GrantDistributionScope
Required
GrantDistributionScope | undefined

The distribution scope for the data grant.

Id
Required
string | undefined

The ID of the data grant.

Name
Required
string | undefined

The name of the data grant.

ReceiverPrincipal
Required
string | undefined

The Amazon Web Services account ID of the data grant receiver.

SenderPrincipal
Required
string | undefined

The Amazon Web Services account ID of the data grant sender.

SourceDataSetId
Required
string | undefined

The ID of the data set used to create the data grant.

UpdatedAt
Required
Date | undefined

The timestamp of when the data grant was last updated.

AcceptedAt
Date | undefined

The timestamp of when the data grant was accepted.

Description
string | undefined

The description of the data grant.

EndsAt
Date | undefined

The timestamp of when access to the associated data set ends.

Tags
Record<string, string> | undefined

The tags associated to the data grant. A tag is a key-value pair.

Throws

Name
Fault
Details
AccessDeniedException
client

Access to the resource is denied.

InternalServerException
server

An exception occurred with the service.

ResourceNotFoundException
client

The resource couldn't be found.

ServiceLimitExceededException
client

The request has exceeded the quotas imposed by the service.

ThrottlingException
client

The limit on the number of requests per second was exceeded.

ValidationException
client

The request was invalid.

DataExchangeServiceException
Base exception class for all service exceptions from DataExchange service.