1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
//! <!-- Bug: Type and Name are switched -->
//! Manages the lifecycle of docker image in a registry. You can upload images to a registry (= `docker push`) and also delete them again
//!
//! ## Example Usage
//!
//! Build an image with the `docker.RemoteImage` resource and then push it to a registry:
//!
//! <!--Start PulumiCodeChooser -->
//! ### Typescript
//! ```typescript
//! import * as pulumi from "@pulumi/pulumi";
//! import * as docker from "@pulumi/docker";
//!
//! const helloworld = new docker.RegistryImage("helloworld", {keepRemotely: true});
//! const image = new docker.RemoteImage("image", {
//! name: "registry.com/somename:1.0",
//! build: {
//! context: `${path.cwd}/absolutePathToContextFolder`,
//! },
//! });
//! ```
//! ### Python
//! ```python
//! import pulumi
//! import pulumi_docker as docker
//!
//! helloworld = docker.RegistryImage("helloworld", keep_remotely=True)
//! image = docker.RemoteImage("image",
//! name="registry.com/somename:1.0",
//! build=docker.RemoteImageBuildArgs(
//! context=f"{path['cwd']}/absolutePathToContextFolder",
//! ))
//! ```
//! ### C#
//! ```csharp
//! using System.Collections.Generic;
//! using System.Linq;
//! using Pulumi;
//! using Docker = Pulumi.Docker;
//!
//! return await Deployment.RunAsync(() =>
//! {
//! var helloworld = new Docker.RegistryImage("helloworld", new()
//! {
//! KeepRemotely = true,
//! });
//!
//! var image = new Docker.RemoteImage("image", new()
//! {
//! Name = "registry.com/somename:1.0",
//! Build = new Docker.Inputs.RemoteImageBuildArgs
//! {
//! Context = $"{path.Cwd}/absolutePathToContextFolder",
//! },
//! });
//!
//! });
//! ```
//! ### Go
//! ```go
//! package main
//!
//! import (
//! "fmt"
//!
//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker"
//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//! )
//!
//! func main() {
//! pulumi.Run(func(ctx *pulumi.Context) error {
//! _, err := docker.NewRegistryImage(ctx, "helloworld", &docker.RegistryImageArgs{
//! KeepRemotely: pulumi.Bool(true),
//! })
//! if err != nil {
//! return err
//! }
//! _, err = docker.NewRemoteImage(ctx, "image", &docker.RemoteImageArgs{
//! Name: pulumi.String("registry.com/somename:1.0"),
//! Build: &docker.RemoteImageBuildArgs{
//! Context: pulumi.String(fmt.Sprintf("%v/absolutePathToContextFolder", path.Cwd)),
//! },
//! })
//! if err != nil {
//! return err
//! }
//! return nil
//! })
//! }
//! ```
//! ### Java
//! ```java
//! package generated_program;
//!
//! import com.pulumi.Context;
//! import com.pulumi.Pulumi;
//! import com.pulumi.core.Output;
//! import com.pulumi.docker.RegistryImage;
//! import com.pulumi.docker.RegistryImageArgs;
//! import com.pulumi.docker.RemoteImage;
//! import com.pulumi.docker.RemoteImageArgs;
//! import com.pulumi.docker.inputs.RemoteImageBuildArgs;
//! import java.util.List;
//! import java.util.ArrayList;
//! import java.util.Map;
//! import java.io.File;
//! import java.nio.file.Files;
//! import java.nio.file.Paths;
//!
//! public class App {
//! public static void main(String[] args) {
//! Pulumi.run(App::stack);
//! }
//!
//! public static void stack(Context ctx) {
//! var helloworld = new RegistryImage("helloworld", RegistryImageArgs.builder()
//! .keepRemotely(true)
//! .build());
//!
//! var image = new RemoteImage("image", RemoteImageArgs.builder()
//! .name("registry.com/somename:1.0")
//! .build(RemoteImageBuildArgs.builder()
//! .context(String.format("%s/absolutePathToContextFolder", path.cwd()))
//! .build())
//! .build());
//!
//! }
//! }
//! ```
//! ### YAML
//! ```yaml
//! resources:
//! helloworld:
//! type: docker:RegistryImage
//! properties:
//! keepRemotely: true
//! image:
//! type: docker:RemoteImage
//! properties:
//! name: registry.com/somename:1.0
//! build:
//! context: ${path.cwd}/absolutePathToContextFolder
//! ```
//! <!--End PulumiCodeChooser -->
#[derive(bon::Builder)]
#[builder(finish_fn = build_struct)]
pub struct RegistryImageArgs {
/// If `true`, the verification of TLS certificates of the server/registry is disabled. Defaults to `false`
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub insecure_skip_verify: pulumi_wasm_rust::Output<Option<bool>>,
/// If true, then the Docker image won't be deleted on destroy operation. If this is false, it will delete the image from the docker registry on destroy operation. Defaults to `false`
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub keep_remotely: pulumi_wasm_rust::Output<Option<bool>>,
/// The name of the Docker image.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub name: pulumi_wasm_rust::Output<Option<String>>,
/// A map of arbitrary strings that, when changed, will force the `docker.RegistryImage` resource to be replaced. This can be used to repush a local image
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub triggers: pulumi_wasm_rust::Output<Option<std::collections::HashMap<String, String>>>,
}
pub struct RegistryImageResult {
/// If `true`, the verification of TLS certificates of the server/registry is disabled. Defaults to `false`
pub insecure_skip_verify: pulumi_wasm_rust::Output<Option<bool>>,
/// If true, then the Docker image won't be deleted on destroy operation. If this is false, it will delete the image from the docker registry on destroy operation. Defaults to `false`
pub keep_remotely: pulumi_wasm_rust::Output<Option<bool>>,
/// The name of the Docker image.
pub name: pulumi_wasm_rust::Output<String>,
/// The sha256 digest of the image.
pub sha256_digest: pulumi_wasm_rust::Output<String>,
/// A map of arbitrary strings that, when changed, will force the `docker.RegistryImage` resource to be replaced. This can be used to repush a local image
pub triggers: pulumi_wasm_rust::Output<Option<std::collections::HashMap<String, String>>>,
}
///
/// Registers a new resource with the given unique name and arguments
///
pub fn create(name: &str, args: RegistryImageArgs) -> RegistryImageResult {
let result = crate::bindings::pulumi::docker::registry_image::invoke(name, &crate::bindings::pulumi::docker::registry_image::Args {
insecure_skip_verify: &args.insecure_skip_verify.get_inner(),
keep_remotely: &args.keep_remotely.get_inner(),
name: &args.name.get_inner(),
triggers: &args.triggers.get_inner(),
});
RegistryImageResult {
insecure_skip_verify: crate::into_domain(result.insecure_skip_verify),
keep_remotely: crate::into_domain(result.keep_remotely),
name: crate::into_domain(result.name),
sha256_digest: crate::into_domain(result.sha256_digest),
triggers: crate::into_domain(result.triggers),
}
}