Skip to content

Commit

Permalink
Kotlin Add the Kotlin ECR Follow (#6589)
Browse files Browse the repository at this point in the history
  • Loading branch information
scmacdon authored Jul 5, 2024
1 parent 252d39b commit 8849358
Show file tree
Hide file tree
Showing 11 changed files with 1,141 additions and 1 deletion.
104 changes: 103 additions & 1 deletion .doc_gen/metadata/ecr_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ ecr_Hello:
synopsis: get started using &ECR;.
category: Hello
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin_hello.main
Java:
versions:
- sdk_version: 2
Expand All @@ -18,6 +27,15 @@ ecr_Hello:
ecr: {listImages}
ecr_PushImageCmd:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.push.image.main
Java:
versions:
- sdk_version: 2
Expand All @@ -31,6 +49,15 @@ ecr_PushImageCmd:
ecr: {PushImageCmd}
ecr_SetRepositoryPolicy:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.set.repo.policy.main
Java:
versions:
- sdk_version: 2
Expand All @@ -44,6 +71,15 @@ ecr_SetRepositoryPolicy:
ecr: {SetRepositoryPolicy}
ecr_GetRepositoryPolicy:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.get.repo.policy.main
Java:
versions:
- sdk_version: 2
Expand All @@ -57,6 +93,15 @@ ecr_GetRepositoryPolicy:
ecr: {GetRepositoryPolicy}
ecr_GetAuthorizationToken:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.get.token.main
Java:
versions:
- sdk_version: 2
Expand All @@ -70,6 +115,15 @@ ecr_GetAuthorizationToken:
ecr: {GetAuthorizationToken}
ecr_StartLifecyclePolicyPreview:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.verify.image.main
Java:
versions:
- sdk_version: 2
Expand All @@ -83,6 +137,15 @@ ecr_StartLifecyclePolicyPreview:
ecr: {StartLifecyclePolicyPreview}
ecr_DescribeImages:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.verify.image.main
Java:
versions:
- sdk_version: 2
Expand All @@ -96,6 +159,15 @@ ecr_DescribeImages:
ecr: {DescribeImages}
ecr_DeleteRepository:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.delete.repo.main
Java:
versions:
- sdk_version: 2
Expand All @@ -109,6 +181,15 @@ ecr_DeleteRepository:
ecr: {DeleteRepository}
ecr_CreateRepository:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.create.repo.main
Java:
versions:
- sdk_version: 2
Expand All @@ -122,6 +203,15 @@ ecr_CreateRepository:
ecr: {CreateRepository}
ecr_DescribeRepositories:
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description:
snippet_tags:
- ecr.kotlin.describe.policy.main
Java:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -170,10 +260,22 @@ ecr_Scenario_RepositoryManagement:
- Delete &ECR; repositories.
category: Scenarios
languages:
Kotlin:
versions:
- sdk_version: 1
github: kotlin/services/ecr
sdkguide:
excerpts:
- description: Run an interactive scenario demonstrating &ECR; features.
snippet_tags:
- ecr.kotlin_scenario.parent.main
- description: A wrapper class for &ECR; SDK methods.
snippet_tags:
- ecr.kotlin_scenario.main
Java:
versions:
- sdk_version: 2
github: javav2/example_code/kms
github: javav2/example_code/ecr
sdkguide:
excerpts:
- description: Run an interactive scenario demonstrating &ECR; features.
Expand Down
1 change: 1 addition & 0 deletions .doc_gen/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ allow_list:
- "v2/service/cognitoidentityprovider/types"
- "abortIncompleteMultipartUploadsOlderThan"
- "com/pinterest/ktlint/releases/download/1"
- "src/main/kotlin/com/example/ecr/HelloECR"
sample_files:
- "README.md"
- "chat_sfn_state_machine.json"
Expand Down
42 changes: 42 additions & 0 deletions kotlin/services/ecr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
123 changes: 123 additions & 0 deletions kotlin/services/ecr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Amazon ECR code examples for the SDK for Kotlin

## Overview

Shows how to use the AWS SDK for Kotlin to work with Amazon Elastic Container Registry (Amazon ECR).

<!--custom.overview.start-->
<!--custom.overview.end-->

_Amazon ECR is a fully managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images._

## ⚠ Important

* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).

<!--custom.important.start-->
<!--custom.important.end-->

## Code examples

### Prerequisites

For prerequisites, see the [README](../../README.md#Prerequisites) in the `kotlin` folder.


<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->

### Get started

- [Hello Amazon ECR](src/main/kotlin/com/example/ecr/HelloECR.kt#L6) (`listImages`)


### Single actions

Code excerpts that show you how to call individual service functions.

- [CreateRepository](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L197)
- [DeleteRepository](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L335)
- [DescribeImages](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L299)
- [DescribeRepositories](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L86)
- [GetAuthorizationToken](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L113)
- [GetRepositoryPolicy](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L132)
- [PushImageCmd](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L250)
- [SetRepositoryPolicy](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L155)
- [StartLifecyclePolicyPreview](src/main/kotlin/com/example/ecr/scenario/ECRActions.kt#L299)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

- [Learn Amazon ECR core operations](src/main/kotlin/com/example/ecr/scenario/ECRScenario.kt)


<!--custom.examples.start-->
<!--custom.examples.end-->

## Run the examples

### Instructions


<!--custom.instructions.start-->
<!--custom.instructions.end-->

#### Hello Amazon ECR

This example shows you how to get started using Amazon ECR.



#### Learn Amazon ECR core operations

This example shows you how to do the following:

- Create an Amazon ECR repository.
- Set repository policies.
- Retrieve repository URIs.
- Get Amazon ECR authorization tokens.
- Set lifecycle policies for Amazon ECR repositories.
- Push a Docker image to an Amazon ECR repository.
- Verify the existence of an image in an Amazon ECR repository.
- List Amazon ECR repositories for your account and get details about them.
- Delete Amazon ECR repositories.

<!--custom.scenario_prereqs.ecr_Scenario_RepositoryManagement.start-->
<!--custom.scenario_prereqs.ecr_Scenario_RepositoryManagement.end-->


<!--custom.scenarios.ecr_Scenario_RepositoryManagement.start-->
<!--custom.scenarios.ecr_Scenario_RepositoryManagement.end-->

### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../../README.md#Tests)
in the `kotlin` folder.



<!--custom.tests.start-->
<!--custom.tests.end-->

## Additional resources

- [Amazon ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/what-is-ecr.html)
- [Amazon ECR API Reference](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/Welcome.html)
- [SDK for Kotlin Amazon ECR reference](https://sdk.amazonaws.com/kotlin/api/latest/iot/index.html)

<!--custom.resources.start-->
<!--custom.resources.end-->

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
Loading

0 comments on commit 8849358

Please sign in to comment.