Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Replace ECR repo example with with example programs (#3691)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnunciato authored Dec 1, 2023
1 parent 6a90967 commit 2b7bce0
Show file tree
Hide file tree
Showing 22 changed files with 264 additions and 7 deletions.
10 changes: 5 additions & 5 deletions themes/default/content/docs/clouds/aws/guides/ecr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions themes/default/static/programs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ _pkginfo.txt
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Vision Studio solution files.
*.sln

# Others
ClientBin/
~$*
Expand Down Expand Up @@ -358,8 +361,8 @@ maven-status
target/

# Nested .gitignores.
/**/.gitignore
!.gitignore
.gitignore
!./.gitignore

# Stack config files.
Pulumi.*.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -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<string, object?>
{
["url"] = repository.Url,
};
});
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.Aws" Version="6.*" />
<PackageReference Include="Pulumi.Awsx" Version="2.*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -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
)
18 changes: 18 additions & 0 deletions themes/default/static/programs/awsx-ecr-repository-go/main.go
Original file line number Diff line number Diff line change
@@ -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
})
}
Original file line number Diff line number Diff line change
@@ -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).
97 changes: 97 additions & 0 deletions themes/default/static/programs/awsx-ecr-repository-java/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.pulumi</groupId>
<artifactId>awsx-ecr-repository-java</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<encoding>UTF-8</encoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<mainClass>myproject.App</mainClass>
<mainArgs/>
</properties>

<dependencies>
<dependency>
<groupId>com.pulumi</groupId>
<artifactId>pulumi</artifactId>
<version>(,1.0]</version>
</dependency>
<dependency>
<groupId>com.pulumi</groupId>
<artifactId>aws</artifactId>
<version>(6.0.2,6.99]</version>
</dependency>
<dependency>
<groupId>com.pulumi</groupId>
<artifactId>awsx</artifactId>
<version>(2.0.0,2.99]</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<mainClass>${mainClass}</mainClass>
<commandlineArgs>${mainArgs}</commandlineArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-wrapper-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mavenVersion>3.8.5</mavenVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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());
});
}
}
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pulumi
import pulumi_awsx as awsx

repository = awsx.ecr.Repository("repository")
pulumi.export("url", repository.url)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as awsx from "@pulumi/awsx";

const repo = new awsx.ecr.Repository("repo");
export const url = repo.url;
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -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"]
}
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 2b7bce0

Please sign in to comment.