- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
GetRepositoryPolicyCommand
Retrieves the repository policy for the specified repository.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ECRClient, GetRepositoryPolicyCommand } from "@aws-sdk/client-ecr"; // ES Modules import
// const { ECRClient, GetRepositoryPolicyCommand } = require("@aws-sdk/client-ecr"); // CommonJS import
const client = new ECRClient(config);
const input = { // GetRepositoryPolicyRequest
registryId: "STRING_VALUE",
repositoryName: "STRING_VALUE", // required
};
const command = new GetRepositoryPolicyCommand(input);
const response = await client.send(command);
// { // GetRepositoryPolicyResponse
// registryId: "STRING_VALUE",
// repositoryName: "STRING_VALUE",
// policyText: "STRING_VALUE",
// };
Example Usage
GetRepositoryPolicyCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
repositoryName Required | string | undefined | The name of the repository with the policy to retrieve. |
registryId | string | undefined | The Amazon Web Services account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed. |
GetRepositoryPolicyCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
policyText | string | undefined | The JSON repository policy text associated with the repository. |
registryId | string | undefined | The registry ID associated with the request. |
repositoryName | string | undefined | The repository name associated with the request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InvalidParameterException | client | The specified parameter is invalid. Review the available parameters for the API request. |
RepositoryNotFoundException | client | The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry. |
RepositoryPolicyNotFoundException | client | The specified repository and registry combination does not have an associated repository policy. |
ServerException | server | These errors are usually caused by a server-side issue. |
ECRServiceException | Base exception class for all service exceptions from ECR service. |