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
//! Reads the image metadata from a Docker Registry. Used in conjunction with the docker.RemoteImage resource to keep an image up to date on the latest available version of the tag.
//!
//! ## Example Usage
//!
//! <!--Start PulumiCodeChooser -->
//! ### Typescript
//! ```typescript
//! import * as pulumi from "@pulumi/pulumi";
//! import * as docker from "@pulumi/docker";
//!
//! const ubuntuRegistryImage = docker.getRegistryImage({
//! name: "ubuntu:precise",
//! });
//! const ubuntuRemoteImage = new docker.RemoteImage("ubuntuRemoteImage", {
//! name: ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.name),
//! pullTriggers: [ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.sha256Digest)],
//! });
//! ```
//! ### Python
//! ```python
//! import pulumi
//! import pulumi_docker as docker
//!
//! ubuntu_registry_image = docker.get_registry_image(name="ubuntu:precise")
//! ubuntu_remote_image = docker.RemoteImage("ubuntuRemoteImage",
//! name=ubuntu_registry_image.name,
//! pull_triggers=[ubuntu_registry_image.sha256_digest])
//! ```
//! ### C#
//! ```csharp
//! using System.Collections.Generic;
//! using System.Linq;
//! using Pulumi;
//! using Docker = Pulumi.Docker;
//!
//! return await Deployment.RunAsync(() =>
//! {
//! var ubuntuRegistryImage = Docker.GetRegistryImage.Invoke(new()
//! {
//! Name = "ubuntu:precise",
//! });
//!
//! var ubuntuRemoteImage = new Docker.RemoteImage("ubuntuRemoteImage", new()
//! {
//! Name = ubuntuRegistryImage.Apply(getRegistryImageResult => getRegistryImageResult.Name),
//! PullTriggers = new[]
//! {
//! ubuntuRegistryImage.Apply(getRegistryImageResult => getRegistryImageResult.Sha256Digest),
//! },
//! });
//!
//! });
//! ```
//! ### Go
//! ```go
//! package main
//!
//! import (
//! "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 {
//! ubuntuRegistryImage, err := docker.LookupRegistryImage(ctx, &docker.LookupRegistryImageArgs{
//! Name: "ubuntu:precise",
//! }, nil)
//! if err != nil {
//! return err
//! }
//! _, err = docker.NewRemoteImage(ctx, "ubuntuRemoteImage", &docker.RemoteImageArgs{
//! Name: pulumi.String(ubuntuRegistryImage.Name),
//! PullTriggers: pulumi.StringArray{
//! pulumi.String(ubuntuRegistryImage.Sha256Digest),
//! },
//! })
//! 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.DockerFunctions;
//! import com.pulumi.docker.inputs.GetRegistryImageArgs;
//! import com.pulumi.docker.RemoteImage;
//! import com.pulumi.docker.RemoteImageArgs;
//! 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) {
//! final var ubuntuRegistryImage = DockerFunctions.getRegistryImage(GetRegistryImageArgs.builder()
//! .name("ubuntu:precise")
//! .build());
//!
//! var ubuntuRemoteImage = new RemoteImage("ubuntuRemoteImage", RemoteImageArgs.builder()
//! .name(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.name()))
//! .pullTriggers(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.sha256Digest()))
//! .build());
//!
//! }
//! }
//! ```
//! ### YAML
//! ```yaml
//! resources:
//! ubuntuRemoteImage:
//! type: docker:RemoteImage
//! properties:
//! name: ${ubuntuRegistryImage.name}
//! pullTriggers:
//! - ${ubuntuRegistryImage.sha256Digest}
//! variables:
//! ubuntuRegistryImage:
//! fn::invoke:
//! Function: docker:getRegistryImage
//! Arguments:
//! name: ubuntu:precise
//! ```
//! <!--End PulumiCodeChooser -->
#[derive(bon::Builder)]
#[builder(finish_fn = build_struct)]
pub struct GetRegistryImageArgs {
/// 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>>,
/// The name of the Docker image, including any tags. e.g. `alpine:latest`
#[builder(into)]
pub name: pulumi_wasm_rust::Output<String>,
}
pub struct GetRegistryImageResult {
/// The provider-assigned unique ID for this managed resource.
pub id: pulumi_wasm_rust::Output<String>,
/// 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>>,
/// The name of the Docker image, including any tags. e.g. `alpine:latest`
pub name: pulumi_wasm_rust::Output<String>,
/// The content digest of the image, as stored in the registry.
pub sha256_digest: pulumi_wasm_rust::Output<String>,
}
///
/// Registers a new resource with the given unique name and arguments
///
pub fn invoke(
args: GetRegistryImageArgs
) -> GetRegistryImageResult {
let result = crate::bindings::pulumi::docker::get_registry_image::invoke(
&crate::bindings::pulumi::docker::get_registry_image::Args {
insecure_skip_verify: &args.insecure_skip_verify.get_inner(),
name: &args.name.get_inner(),
}
);
GetRegistryImageResult {
id: crate::into_domain(result.id),
insecure_skip_verify: crate::into_domain(result.insecure_skip_verify),
name: crate::into_domain(result.name),
sha256_digest: crate::into_domain(result.sha256_digest),
}
}