diff --git a/ovh-csharp/${PROJECT}.csproj b/ovh-csharp/${PROJECT}.csproj new file mode 100644 index 00000000..1477561a --- /dev/null +++ b/ovh-csharp/${PROJECT}.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + enable + + + + + + + + + diff --git a/ovh-csharp/Program.cs b/ovh-csharp/Program.cs new file mode 100644 index 00000000..50b64fa9 --- /dev/null +++ b/ovh-csharp/Program.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Linq; +using Pulumi; +using Ovh = Pulumi.Ovh; +using System; + +return await Deployment.RunAsync(() => +{ + // Get some configuration values (or use defaults) + var config = new Pulumi.Config(); + var ovhServiceName = config.Require("ovhServiceName"); + var ovhRegion = config.Get("ovhRegion") ?? "GRA"; + var planName = config.Get("planName") ?? "SMALL"; + var registryName = config.Get("registryName") ?? "my-registry"; + + var registryUserName = config.Get("registryUserName") ?? "user"; + var registryUserEmail = config.Get("registryUserEmail") ?? "myuser@ovh.com"; + var registryUserLogin = config.Get("registryUserLogin") ?? "myuser"; + + // Initiate the configuration of the registry + var regcap = Ovh.CloudProject.GetCapabilitiesContainerFilter.Invoke(new() + { + ServiceName = ovhServiceName, + PlanName = planName, + Region = ovhRegion, + }); + + // Deploy a new Managed private registry + var myRegistry = new Ovh.CloudProject.ContainerRegistry(registryName, new() + { + ServiceName = regcap.Apply(getCapabilitiesContainerFilterResult => getCapabilitiesContainerFilterResult.ServiceName), + PlanId = regcap.Apply(getCapabilitiesContainerFilterResult => getCapabilitiesContainerFilterResult.Id), + Region = regcap.Apply(getCapabilitiesContainerFilterResult => getCapabilitiesContainerFilterResult.Region), + }); + + // Create a Private Registry User + var myRegistryUser = new Ovh.CloudProject.ContainerRegistryUser(registryUserName, new() + { + ServiceName = ovhServiceName, + RegistryId = myRegistry.Id, + Email = registryUserEmail, + Login = registryUserLogin, + }); + + // Export some values for use elsewhere + return new Dictionary + { + ["registryURL"] = myRegistry.Url, + ["registryUser"] = myRegistryUser.User, + ["registryPassword"] = myRegistryUser.Password, + }; +}); diff --git a/ovh-csharp/Pulumi.yaml b/ovh-csharp/Pulumi.yaml new file mode 100644 index 00000000..7b9f5496 --- /dev/null +++ b/ovh-csharp/Pulumi.yaml @@ -0,0 +1,26 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: dotnet +template: + description: A minimal OVHcloud C# Pulumi program + config: + ovhServiceName: + description: The OVHcloud Public Cloud Project to deploy into + ovhRegion: + default: GRA + description: The OVHcloud region to deploy into + planName: + default: SMALL + description: Name of the plan + registryName: + default: my-registry + description: Name of the private registry + registryUserName: + default: user + description: Name of the user + registryUserEmail: + default: myuser@ovh.com + description: Email of the user + registryUserLogin: + default: myuser + description: Login of the user \ No newline at end of file diff --git a/ovh-go/Pulumi.yaml b/ovh-go/Pulumi.yaml new file mode 100644 index 00000000..e01f152c --- /dev/null +++ b/ovh-go/Pulumi.yaml @@ -0,0 +1,26 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: go +template: + description: A minimal OVHcloud Go Pulumi program + config: + ovhServiceName: + description: The OVHcloud Public Cloud Project to deploy into + ovhRegion: + default: GRA + description: The OVHcloud region to deploy into + planName: + default: SMALL + description: Name of the plan + registryName: + default: my-registry + description: Name of the private registry + registryUserName: + default: user + description: Name of the user + registryUserEmail: + default: myuser@ovh.com + description: Email of the user + registryUserLogin: + default: myuser + description: Login of the user diff --git a/ovh-go/go.mod b/ovh-go/go.mod new file mode 100644 index 00000000..e5a39029 --- /dev/null +++ b/ovh-go/go.mod @@ -0,0 +1,93 @@ +module kubernetes-ovh-go + +go 1.22 + +require ( + github.com/ovh/pulumi-ovh/sdk v1.1.0 + github.com/pulumi/pulumi/sdk/v3 v3.137.0 +) + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect + github.com/agext/levenshtein v1.2.3 // indirect + github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/atotto/clipboard v0.1.4 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/blang/semver v3.5.1+incompatible // indirect + github.com/charmbracelet/bubbles v0.16.1 // indirect + github.com/charmbracelet/bubbletea v0.25.0 // indirect + github.com/charmbracelet/lipgloss v0.7.1 // indirect + github.com/cheggaaa/pb v1.0.29 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/djherbis/times v1.5.0 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.2.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/hcl/v2 v2.17.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-localereader v0.0.1 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mitchellh/go-ps v1.0.0 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.2 // indirect + github.com/opentracing/basictracer-go v1.1.0 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pgavlin/fx v0.1.6 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/term v1.1.0 // indirect + github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect + github.com/pulumi/esc v0.9.1 // indirect + github.com/rivo/uniseg v0.4.4 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect + github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/skeema/knownhosts v1.2.2 // indirect + github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/texttheater/golang-levenshtein v1.0.1 // indirect + github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect + github.com/uber/jaeger-lib v2.4.1+incompatible // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + github.com/zclconf/go-cty v1.13.2 // indirect + go.uber.org/atomic v1.9.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect + golang.org/x/mod v0.18.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.22.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/frand v1.4.2 // indirect +) + diff --git a/ovh-go/main.go b/ovh-go/main.go new file mode 100644 index 00000000..b34def51 --- /dev/null +++ b/ovh-go/main.go @@ -0,0 +1,82 @@ +package main + +import ( + "github.com/ovh/pulumi-ovh/sdk/go/ovh/cloudproject" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" +) + +func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + // Get some configuration values or use defaults + cfg := config.New(ctx, "") + ovhServiceName := cfg.Require("ovhServiceName") + ovhRegion, err := cfg.Try("ovhRegion") + if err != nil { + ovhRegion = "GRA" + } + + planName, err := cfg.Try("planName") + if err != nil { + planName = "SMALL" + } + + registryName, err := cfg.Try("registryName") + if err != nil { + registryName = "my-registry" + } + + registryUserName, err := cfg.Try("registryUserName") + if err != nil { + registryUserName = "user" + } + + registryUserEmail, err := cfg.Try("registryUserEmail") + if err != nil { + registryUserEmail = "myuser@ovh.com" + } + + registryUserLogin, err := cfg.Try("registryUserLogin") + if err != nil { + registryUserLogin = "myuser" + } + + // Initiate the configuration of the registry + regcap, err := cloudproject.GetCapabilitiesContainerFilter(ctx, &cloudproject.GetCapabilitiesContainerFilterArgs{ + ServiceName: ovhServiceName, + PlanName: planName, + Region: ovhRegion, + }, nil) + if err != nil { + return err + } + + // Deploy a new Managed private registry + myRegistry, err := cloudproject.NewContainerRegistry(ctx, registryName, &cloudproject.ContainerRegistryArgs{ + ServiceName: pulumi.String(regcap.ServiceName), + PlanId: pulumi.String(regcap.Id), + Region: pulumi.String(regcap.Region), + }) + if err != nil { + return err + } + + // Create a Private Registry User + myRegistryUser, err := cloudproject.NewContainerRegistryUser(ctx, registryUserName, &cloudproject.ContainerRegistryUserArgs{ + ServiceName: pulumi.String(regcap.ServiceName), + RegistryId: myRegistry.ID(), + Email: pulumi.String(registryUserEmail), + Login: pulumi.String(registryUserLogin), + }) + if err != nil { + return err + } + + // Add as an output registry information + ctx.Export("registryURL", myRegistry.Url) + ctx.Export("registryUser", myRegistryUser.User) + ctx.Export("registryPassword", myRegistryUser.Password) + + return nil + }) +} diff --git a/ovh-java/Pulumi.yaml b/ovh-java/Pulumi.yaml new file mode 100644 index 00000000..d7609576 --- /dev/null +++ b/ovh-java/Pulumi.yaml @@ -0,0 +1,26 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: java +template: + description: A minimal OVHcloud Java Pulumi program + config: + ovhServiceName: + description: The OVHcloud Public Cloud Project to deploy into + ovhRegion: + default: GRA + description: The OVHcloud region to deploy into + planName: + default: SMALL + description: Name of the plan + registryName: + default: my-registry + description: Name of the private registry + registryUserName: + default: user + description: Name of the user + registryUserEmail: + default: myuser@ovh.com + description: Email of the user + registryUserLogin: + default: myuser + description: Login of the user diff --git a/ovh-java/pom.xml b/ovh-java/pom.xml new file mode 100644 index 00000000..f6e4fb36 --- /dev/null +++ b/ovh-java/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + com.pulumi + ${PROJECT} + 1.0-SNAPSHOT + + + UTF-8 + 21 + 21 + 21 + myproject.App + + + + + + com.pulumi + pulumi + (,1.0] + + + com.ovhcloud.pulumi.ovh + pulumi-ovh + 1.1.0 + + + + + + + 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 + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 11 + 11 + + + + + diff --git a/ovh-java/src/main/java/myproject/App.java b/ovh-java/src/main/java/myproject/App.java new file mode 100644 index 00000000..abc7bf5c --- /dev/null +++ b/ovh-java/src/main/java/myproject/App.java @@ -0,0 +1,58 @@ +package myproject; + +import com.ovhcloud.pulumi.ovh.CloudProject.CloudProjectFunctions; +import com.ovhcloud.pulumi.ovh.CloudProject.inputs.GetCapabilitiesContainerFilterArgs; +import com.ovhcloud.pulumi.ovh.CloudProject.inputs.GetContainerRegistryArgs; +import com.ovhcloud.pulumi.ovh.CloudProject.ContainerRegistry; +import com.ovhcloud.pulumi.ovh.CloudProject.ContainerRegistryArgs; +import com.ovhcloud.pulumi.ovh.CloudProject.ContainerRegistryUser; +import com.ovhcloud.pulumi.ovh.CloudProject.ContainerRegistryUserArgs; +import com.pulumi.Context; +import com.pulumi.Pulumi; + +public class App { + + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + + var config = ctx.config(); + var ovhServiceName = config.require("ovhServiceName"); + var ovhRegion = config.get("ovhRegion").orElse("GRA"); + var planName = config.get("planName").orElse("SMALL"); + + var registryName = config.get("registryName").orElse("my-registry"); + var registryUserName = config.get("registryUserName").orElse("user"); + var registryUserEmail = config.get("registryUserEmail").orElse("myuser@ovh.com"); + var registryUserLogin = config.get("registryUserLogin").orElse("myuser"); + + // Initiate the configuration of the registry + final var regcap = CloudProjectFunctions.getCapabilitiesContainerFilter(GetCapabilitiesContainerFilterArgs.builder() + .serviceName(ovhServiceName) + .planName(planName) + .region(ovhRegion) + .build()); + + // Deploy a new Managed private registry + var myRegistry = new ContainerRegistry("myRegistry", ContainerRegistryArgs.builder() + .serviceName(regcap.applyValue(getCapabilitiesContainerFilterResult -> getCapabilitiesContainerFilterResult.serviceName())) + .planId(regcap.applyValue(getCapabilitiesContainerFilterResult -> getCapabilitiesContainerFilterResult.id())) + .region(regcap.applyValue(getCapabilitiesContainerFilterResult -> getCapabilitiesContainerFilterResult.region())) + .build()); + + // Create a Private Registry User + var myRegistryUser = new ContainerRegistryUser(registryUserName, ContainerRegistryUserArgs.builder() + .serviceName(ovhServiceName) + .registryId(myRegistry.id().asPlaintext()) + .email(registryUserEmail) + .login(registryUserLogin) + .build()); + + // Add as an output registry information + ctx.export("registryURL", myRegistry.url().asPlaintext()); + ctx.export("registryUser", myRegistryUser.user().asPlaintext()); + ctx.export("registryPassword", myRegistryUser.password().asPlaintext()); + } +} \ No newline at end of file diff --git a/ovh-python/.gitignore b/ovh-python/.gitignore new file mode 100644 index 00000000..a3807e5b --- /dev/null +++ b/ovh-python/.gitignore @@ -0,0 +1,2 @@ +*.pyc +venv/ diff --git a/ovh-python/Pulumi.yaml b/ovh-python/Pulumi.yaml new file mode 100644 index 00000000..f955b3a5 --- /dev/null +++ b/ovh-python/Pulumi.yaml @@ -0,0 +1,26 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: python +template: + description: A minimal OVHcloud Python Pulumi program + config: + ovhServiceName: + description: The OVHcloud Public Cloud Project to deploy into + ovhRegion: + default: GRA + description: The OVHcloud region to deploy into + planName: + default: SMALL + description: Name of the plan + registryName: + default: my-registry + description: Name of the private registry + registryUserName: + default: user + description: Name of the user + registryUserEmail: + default: myuser@ovh.com + description: Email of the user + registryUserLogin: + default: myuser + description: Login of the user diff --git a/ovh-python/__main__.py b/ovh-python/__main__.py new file mode 100644 index 00000000..97ad6957 --- /dev/null +++ b/ovh-python/__main__.py @@ -0,0 +1,37 @@ +import pulumi +import pulumi_ovh as ovh + +# Get some configuration values +config = pulumi.Config(); + +ovh_service_name = config.require('ovhServiceName') +ovh_region = config.get("ovhRegion", "GRA") +plan_name = config.get("planName", "SMALL") + +registry_name = config.get("registryName", "my-registry") +registry_user_name = config.get("registryUserName", "user") +registry_user_email = config.get("registryUserEmail", "myuser@ovh.com") +registry_user_login = config.get("registryUserLogin", "myuser") + +# Initiate the configuration of the registry +regcap = ovh.cloudproject.get_capabilities_container_filter(service_name=ovh_service_name, + plan_name=plan_name, + region=ovh_region) + +# Deploy a new Managed private registry +my_registry = ovh.cloudproject.ContainerRegistry(registry_name, + service_name=regcap.service_name, + plan_id=regcap.id, + region=regcap.region) + +# Create a Private Registry User +user = ovh.cloudproject.ContainerRegistryUser(registry_user_name, + service_name=ovh_service_name, + registry_id=my_registry.id, + email=registry_user_email, + login=registry_user_login) + +# Add as an output registry information +pulumi.export("registryURL", my_registry.url) +pulumi.export("registryUser", user.user) +pulumi.export("registryPassword", user.password) diff --git a/ovh-python/requirements.txt b/ovh-python/requirements.txt new file mode 100644 index 00000000..8b98921d --- /dev/null +++ b/ovh-python/requirements.txt @@ -0,0 +1,2 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-ovh diff --git a/ovh-typescript/.gitignore b/ovh-typescript/.gitignore new file mode 100644 index 00000000..c6958891 --- /dev/null +++ b/ovh-typescript/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/node_modules/ diff --git a/ovh-typescript/Pulumi.yaml b/ovh-typescript/Pulumi.yaml new file mode 100644 index 00000000..e15114de --- /dev/null +++ b/ovh-typescript/Pulumi.yaml @@ -0,0 +1,27 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: nodejs +template: + description: A minimal OVHcloud TypeScript Pulumi program + config: + ovhServiceName: + description: The OVHcloud Public Cloud Project to deploy into + ovhRegion: + default: GRA + description: The OVHcloud region to deploy into + planName: + default: SMALL + description: Name of the plan + registryName: + default: my-registry + description: Name of the private registry + registryUserName: + default: user + description: Name of the user + registryUserEmail: + default: myuser@ovh.com + description: Email of the user + registryUserLogin: + default: myuser + description: Login of the user + diff --git a/ovh-typescript/index.ts b/ovh-typescript/index.ts new file mode 100644 index 00000000..4a8d9980 --- /dev/null +++ b/ovh-typescript/index.ts @@ -0,0 +1,40 @@ +import * as pulumi from "@pulumi/pulumi"; +import * as ovh from "@ovhcloud/pulumi-ovh"; + +// Get configuration values or use defaults +const config = new pulumi.Config(); +const ovhServiceName = config.require("ovhServiceName"); +const ovhRegion = config.get("ovhRegion") || "GRA"; +const planName = config.get("planName") || "SMALL"; + +const registryName = config.get("registryName") || "my-registry"; +const registryUserName = config.get("registryUserName") || "user"; +const registryUserEmail = config.get("registryUserEmail") || "myuser@ovh.com"; +const registryUserLogin = config.get("registryUserLogin") || "myuser"; + +// Initiate the configuration of the registry +const regcap = ovh.cloudproject.getCapabilitiesContainerFilter({ + serviceName: ovhServiceName, + planName: planName, + region: ovhRegion, +}); + +// Deploy a new Managed private registry +const myRegistry = new ovh.cloudproject.ContainerRegistry(registryName, { + serviceName: regcap.then((regcap: { serviceName: any; }) => regcap.serviceName), + planId: regcap.then((regcap: { id: any; }) => regcap.id), + region: regcap.then((regcap: { region: any; }) => regcap.region), +}); + +// Create a Private Registry User +const myRegistryUser = new ovh.cloudproject.ContainerRegistryUser(registryUserName, { + serviceName: ovhServiceName, + registryId: myRegistry.id, + email: registryUserEmail, + login: registryUserLogin, +}); + +// Add as an output registry information +export const registryURL = myRegistry.url; +export const registryUser = myRegistryUser.user; +export const registryPassword = myRegistryUser.password; diff --git a/ovh-typescript/package.json b/ovh-typescript/package.json new file mode 100644 index 00000000..0ecfea53 --- /dev/null +++ b/ovh-typescript/package.json @@ -0,0 +1,12 @@ +{ + "name": "ovh-typescript", + "main": "index.ts", + "devDependencies": { + "@types/node": "^16" + }, + "dependencies": { + "@ovhcloud/pulumi-ovh": "^1.1.0", + "@pulumi/pulumi": "^3.0.0" + } +} + diff --git a/ovh-typescript/tsconfig.json b/ovh-typescript/tsconfig.json new file mode 100644 index 00000000..ab65afa6 --- /dev/null +++ b/ovh-typescript/tsconfig.json @@ -0,0 +1,18 @@ +{ + "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" + ] +}