From 2b7bce06626be6aaf783cbb855a9b5db852f152f Mon Sep 17 00:00:00 2001 From: Christian Nunciato Date: Fri, 1 Dec 2023 13:14:56 -0800 Subject: [PATCH] Replace ECR repo example with with example programs (#3691) --- .../content/docs/clouds/aws/guides/ecr.md | 10 +- themes/default/static/programs/.gitignore | 7 +- .../awsx-ecr-repository-csharp/Program.cs | 14 +++ .../awsx-ecr-repository-csharp/Pulumi.yaml | 3 + .../awsx-ecr-repository-csharp.csproj | 15 +++ .../awsx-ecr-repository-go/Pulumi.yaml | 3 + .../awsx-ecr-repository-go/go.mod.txt | 8 ++ .../programs/awsx-ecr-repository-go/main.go | 18 ++++ .../awsx-ecr-repository-java/Pulumi.yaml | 3 + .../programs/awsx-ecr-repository-java/pom.xml | 97 +++++++++++++++++++ .../src/main/java/myproject/App.java | 14 +++ .../Pulumi.yaml | 6 ++ .../awsx-ecr-repository-javascript/index.js | 7 ++ .../package.json | 9 ++ .../awsx-ecr-repository-python/Pulumi.yaml | 6 ++ .../awsx-ecr-repository-python/__main__.py | 5 + .../requirements.txt | 3 + .../Pulumi.yaml | 3 + .../awsx-ecr-repository-typescript/index.ts | 4 + .../package.json | 12 +++ .../tsconfig.json | 16 +++ .../awsx-ecr-repository-yaml/Pulumi.yaml | 8 ++ 22 files changed, 264 insertions(+), 7 deletions(-) create mode 100644 themes/default/static/programs/awsx-ecr-repository-csharp/Program.cs create mode 100644 themes/default/static/programs/awsx-ecr-repository-csharp/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-csharp/awsx-ecr-repository-csharp.csproj create mode 100644 themes/default/static/programs/awsx-ecr-repository-go/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-go/go.mod.txt create mode 100644 themes/default/static/programs/awsx-ecr-repository-go/main.go create mode 100644 themes/default/static/programs/awsx-ecr-repository-java/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-java/pom.xml create mode 100644 themes/default/static/programs/awsx-ecr-repository-java/src/main/java/myproject/App.java create mode 100644 themes/default/static/programs/awsx-ecr-repository-javascript/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-javascript/index.js create mode 100644 themes/default/static/programs/awsx-ecr-repository-javascript/package.json create mode 100644 themes/default/static/programs/awsx-ecr-repository-python/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-python/__main__.py create mode 100644 themes/default/static/programs/awsx-ecr-repository-python/requirements.txt create mode 100644 themes/default/static/programs/awsx-ecr-repository-typescript/Pulumi.yaml create mode 100644 themes/default/static/programs/awsx-ecr-repository-typescript/index.ts create mode 100644 themes/default/static/programs/awsx-ecr-repository-typescript/package.json create mode 100644 themes/default/static/programs/awsx-ecr-repository-typescript/tsconfig.json create mode 100644 themes/default/static/programs/awsx-ecr-repository-yaml/Pulumi.yaml diff --git a/themes/default/content/docs/clouds/aws/guides/ecr.md b/themes/default/content/docs/clouds/aws/guides/ecr.md index 63c33c42002..1d872afee18 100644 --- a/themes/default/content/docs/clouds/aws/guides/ecr.md +++ b/themes/default/content/docs/clouds/aws/guides/ecr.md @@ -48,11 +48,11 @@ From there, we can just run `pulumi up` to provision a new repository: $ pulumi up Updating (dev): - Type Name Status - + pulumi:pulumi:Stack crosswalk-aws-dev created - + ├─ awsx:ecr:Repository repository created - + │ └─ aws:ecr:Repository repository created - + └─ aws:ecr:LifecyclePolicy repository created + Type Name Status + + pulumi:pulumi:Stack my-project-dev create + + └─ awsx:ecr:Repository repository create + + ├─ aws:ecr:Repository repository create + + └─ aws:ecr:LifecyclePolicy repository create Outputs: url: "012345678901.dkr.ecr.us-west-2.amazonaws.com/repository-e2fe830" diff --git a/themes/default/static/programs/.gitignore b/themes/default/static/programs/.gitignore index 828634019f0..0e2fdf33b21 100644 --- a/themes/default/static/programs/.gitignore +++ b/themes/default/static/programs/.gitignore @@ -222,6 +222,9 @@ _pkginfo.txt # but keep track of directories ending in .cache !?*.[Cc]ache/ +# Vision Studio solution files. +*.sln + # Others ClientBin/ ~$* @@ -358,8 +361,8 @@ maven-status target/ # Nested .gitignores. -/**/.gitignore -!.gitignore +.gitignore +!./.gitignore # Stack config files. Pulumi.*.yaml diff --git a/themes/default/static/programs/awsx-ecr-repository-csharp/Program.cs b/themes/default/static/programs/awsx-ecr-repository-csharp/Program.cs new file mode 100644 index 00000000000..3604000a5b2 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-csharp/Program.cs @@ -0,0 +1,14 @@ +using Pulumi; +using Pulumi.Aws.S3; +using Awsx = Pulumi.Awsx; +using System.Collections.Generic; + +return await Deployment.RunAsync(() => +{ + var repository = new Awsx.Ecr.Repository("repository"); + + return new Dictionary + { + ["url"] = repository.Url, + }; +}); diff --git a/themes/default/static/programs/awsx-ecr-repository-csharp/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-csharp/Pulumi.yaml new file mode 100644 index 00000000000..356f55fe64f --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-csharp/Pulumi.yaml @@ -0,0 +1,3 @@ +name: awsx-ecr-repository-csharp +runtime: dotnet +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-csharp/awsx-ecr-repository-csharp.csproj b/themes/default/static/programs/awsx-ecr-repository-csharp/awsx-ecr-repository-csharp.csproj new file mode 100644 index 00000000000..ac10d4fba32 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-csharp/awsx-ecr-repository-csharp.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + enable + + + + + + + + + diff --git a/themes/default/static/programs/awsx-ecr-repository-go/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-go/Pulumi.yaml new file mode 100644 index 00000000000..37a866b9c60 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-go/Pulumi.yaml @@ -0,0 +1,3 @@ +name: awsx-ecr-repository-go +runtime: go +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-go/go.mod.txt b/themes/default/static/programs/awsx-ecr-repository-go/go.mod.txt new file mode 100644 index 00000000000..0601d77ee3c --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-go/go.mod.txt @@ -0,0 +1,8 @@ +module awsx-ecr-repository-go + +go 1.20 + +require ( + github.com/pulumi/pulumi-awsx/sdk/v2 v2.3.0 + github.com/pulumi/pulumi/sdk/v3 v3.93.0 +) diff --git a/themes/default/static/programs/awsx-ecr-repository-go/main.go b/themes/default/static/programs/awsx-ecr-repository-go/main.go new file mode 100644 index 00000000000..f340498421b --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-go/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/ecr" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + repository, err := ecr.NewRepository(ctx, "repository", nil) + if err != nil { + return err + } + + ctx.Export("url", repository.Url) + return nil + }) +} diff --git a/themes/default/static/programs/awsx-ecr-repository-java/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-java/Pulumi.yaml new file mode 100644 index 00000000000..d704d6db6a1 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-java/Pulumi.yaml @@ -0,0 +1,3 @@ +name: awsx-ecr-repository-java +runtime: java +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-java/pom.xml b/themes/default/static/programs/awsx-ecr-repository-java/pom.xml new file mode 100644 index 00000000000..4f4b00b94c4 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-java/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.pulumi + awsx-ecr-repository-java + 1.0-SNAPSHOT + + + UTF-8 + 11 + 11 + 11 + myproject.App + + + + + + com.pulumi + pulumi + (,1.0] + + + com.pulumi + aws + (6.0.2,6.99] + + + com.pulumi + awsx + (2.0.0,2.99] + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + + true + ${mainClass} + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + + true + ${mainClass} + + + + jar-with-dependencies + + + + + make-my-jar-with-dependencies + package + + single + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + ${mainClass} + ${mainArgs} + + + + org.apache.maven.plugins + maven-wrapper-plugin + 3.1.0 + + 3.8.5 + + + + + diff --git a/themes/default/static/programs/awsx-ecr-repository-java/src/main/java/myproject/App.java b/themes/default/static/programs/awsx-ecr-repository-java/src/main/java/myproject/App.java new file mode 100644 index 00000000000..0433435e8a6 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-java/src/main/java/myproject/App.java @@ -0,0 +1,14 @@ +package myproject; + +import com.pulumi.Pulumi; +import com.pulumi.awsx.ecr.Repository; + +public class App { + public static void main(String[] args) { + Pulumi.run(ctx -> { + var repository = new Repository("repository"); + + ctx.export("url", repository.url()); + }); + } +} diff --git a/themes/default/static/programs/awsx-ecr-repository-javascript/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-javascript/Pulumi.yaml new file mode 100644 index 00000000000..416320fdec3 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-javascript/Pulumi.yaml @@ -0,0 +1,6 @@ +name: awsx-ecr-repository-javascript +runtime: + name: nodejs + options: + typescript: false +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-javascript/index.js b/themes/default/static/programs/awsx-ecr-repository-javascript/index.js new file mode 100644 index 00000000000..1c8d3e68aa9 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-javascript/index.js @@ -0,0 +1,7 @@ +"use strict"; +const pulumi = require("@pulumi/pulumi"); +const aws = require("@pulumi/aws"); +const awsx = require("@pulumi/awsx"); + +const repo = new awsx.ecr.Repository("repo"); +exports.url = repo.url; diff --git a/themes/default/static/programs/awsx-ecr-repository-javascript/package.json b/themes/default/static/programs/awsx-ecr-repository-javascript/package.json new file mode 100644 index 00000000000..e5d9f819ee6 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-javascript/package.json @@ -0,0 +1,9 @@ +{ + "name": "awsx-ecr-repository-javascript", + "main": "index.js", + "dependencies": { + "@pulumi/pulumi": "^3.0.0", + "@pulumi/aws": "^6.0.0", + "@pulumi/awsx": "^2.0.2" + } +} diff --git a/themes/default/static/programs/awsx-ecr-repository-python/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-python/Pulumi.yaml new file mode 100644 index 00000000000..63c1ef30868 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-python/Pulumi.yaml @@ -0,0 +1,6 @@ +name: awsx-ecr-repository-python +runtime: + name: python + options: + virtualenv: venv +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-python/__main__.py b/themes/default/static/programs/awsx-ecr-repository-python/__main__.py new file mode 100644 index 00000000000..61809458f81 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-python/__main__.py @@ -0,0 +1,5 @@ +import pulumi +import pulumi_awsx as awsx + +repository = awsx.ecr.Repository("repository") +pulumi.export("url", repository.url) diff --git a/themes/default/static/programs/awsx-ecr-repository-python/requirements.txt b/themes/default/static/programs/awsx-ecr-repository-python/requirements.txt new file mode 100644 index 00000000000..c8097039a51 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-python/requirements.txt @@ -0,0 +1,3 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-aws>=6.0.2,<7.0.0 +pulumi-awsx>=2.0.0,<3.0.0 diff --git a/themes/default/static/programs/awsx-ecr-repository-typescript/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-typescript/Pulumi.yaml new file mode 100644 index 00000000000..fde0d76255a --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-typescript/Pulumi.yaml @@ -0,0 +1,3 @@ +name: awsx-ecr-repository-typescript +runtime: nodejs +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). diff --git a/themes/default/static/programs/awsx-ecr-repository-typescript/index.ts b/themes/default/static/programs/awsx-ecr-repository-typescript/index.ts new file mode 100644 index 00000000000..56a59f5ab09 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-typescript/index.ts @@ -0,0 +1,4 @@ +import * as awsx from "@pulumi/awsx"; + +const repo = new awsx.ecr.Repository("repo"); +export const url = repo.url; diff --git a/themes/default/static/programs/awsx-ecr-repository-typescript/package.json b/themes/default/static/programs/awsx-ecr-repository-typescript/package.json new file mode 100644 index 00000000000..bbd23356f28 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-typescript/package.json @@ -0,0 +1,12 @@ +{ + "name": "awsx-ecr-repository-typescript", + "main": "index.ts", + "devDependencies": { + "@types/node": "^18" + }, + "dependencies": { + "@pulumi/pulumi": "^3.0.0", + "@pulumi/aws": "^6.0.0", + "@pulumi/awsx": "^2.0.2" + } +} diff --git a/themes/default/static/programs/awsx-ecr-repository-typescript/tsconfig.json b/themes/default/static/programs/awsx-ecr-repository-typescript/tsconfig.json new file mode 100644 index 00000000000..cd76e4fc372 --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-typescript/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "strict": true, + "outDir": "bin", + "target": "es2016", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "experimentalDecorators": true, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.ts"] +} diff --git a/themes/default/static/programs/awsx-ecr-repository-yaml/Pulumi.yaml b/themes/default/static/programs/awsx-ecr-repository-yaml/Pulumi.yaml new file mode 100644 index 00000000000..ec6e0e568af --- /dev/null +++ b/themes/default/static/programs/awsx-ecr-repository-yaml/Pulumi.yaml @@ -0,0 +1,8 @@ +name: awsx-ecr-repository-yaml +runtime: yaml +description: An example that creates a container-image repository in Amazon Elastic Container Registry (ECR). +resources: + repository: + type: awsx:ecr:Repository +outputs: + url: ${repository.url}