alicloud.cr.Namespace
Explore with Pulumi AI
This resource will help you to manager Container Registry namespaces, see What is Namespace.
NOTE: Available since v1.34.0.
NOTE: You need to set your registry password in Container Registry console before use this resource.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new random.index.Integer("default", {
min: 10000000,
max: 99999999,
});
const example = new alicloud.cr.Namespace("example", {
name: `${name}-${_default.result}`,
autoCreate: false,
defaultVisibility: "PUBLIC",
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = random.index.Integer("default",
min=10000000,
max=99999999)
example = alicloud.cr.Namespace("example",
name=f"{name}-{default['result']}",
auto_create=False,
default_visibility="PUBLIC")
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cr"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"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 {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000000,
Max: 99999999,
})
if err != nil {
return err
}
_, err = cr.NewNamespace(ctx, "example", &cr.NamespaceArgs{
Name: pulumi.Sprintf("%v-%v", name, _default.Result),
AutoCreate: pulumi.Bool(false),
DefaultVisibility: pulumi.String("PUBLIC"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000000,
Max = 99999999,
});
var example = new AliCloud.CR.Namespace("example", new()
{
Name = $"{name}-{@default.Result}",
AutoCreate = false,
DefaultVisibility = "PUBLIC",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.cr.Namespace;
import com.pulumi.alicloud.cr.NamespaceArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
var default_ = new Integer("default", IntegerArgs.builder()
.min(10000000)
.max(99999999)
.build());
var example = new Namespace("example", NamespaceArgs.builder()
.name(String.format("%s-%s", name,default_.result()))
.autoCreate(false)
.defaultVisibility("PUBLIC")
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: random:integer
properties:
min: 1e+07
max: 9.9999999e+07
example:
type: alicloud:cr:Namespace
properties:
name: ${name}-${default.result}
autoCreate: false
defaultVisibility: PUBLIC
Create Namespace Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Namespace(name: string, args: NamespaceArgs, opts?: CustomResourceOptions);
@overload
def Namespace(resource_name: str,
args: NamespaceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Namespace(resource_name: str,
opts: Optional[ResourceOptions] = None,
auto_create: Optional[bool] = None,
default_visibility: Optional[str] = None,
name: Optional[str] = None)
func NewNamespace(ctx *Context, name string, args NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
public Namespace(string name, NamespaceArgs args, CustomResourceOptions? opts = null)
public Namespace(String name, NamespaceArgs args)
public Namespace(String name, NamespaceArgs args, CustomResourceOptions options)
type: alicloud:cr:Namespace
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NamespaceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NamespaceArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NamespaceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NamespaceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NamespaceArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var alicloudNamespaceResource = new AliCloud.CR.Namespace("alicloudNamespaceResource", new()
{
AutoCreate = false,
DefaultVisibility = "string",
Name = "string",
});
example, err := cr.NewNamespace(ctx, "alicloudNamespaceResource", &cr.NamespaceArgs{
AutoCreate: pulumi.Bool(false),
DefaultVisibility: pulumi.String("string"),
Name: pulumi.String("string"),
})
var alicloudNamespaceResource = new Namespace("alicloudNamespaceResource", NamespaceArgs.builder()
.autoCreate(false)
.defaultVisibility("string")
.name("string")
.build());
alicloud_namespace_resource = alicloud.cr.Namespace("alicloudNamespaceResource",
auto_create=False,
default_visibility="string",
name="string")
const alicloudNamespaceResource = new alicloud.cr.Namespace("alicloudNamespaceResource", {
autoCreate: false,
defaultVisibility: "string",
name: "string",
});
type: alicloud:cr:Namespace
properties:
autoCreate: false
defaultVisibility: string
name: string
Namespace Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Namespace resource accepts the following input properties:
- Auto
Create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- Default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- Name string
- Name of Container Registry namespace.
- Auto
Create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- Default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- Name string
- Name of Container Registry namespace.
- auto
Create Boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility String PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name String
- Name of Container Registry namespace.
- auto
Create boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name string
- Name of Container Registry namespace.
- auto_
create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default_
visibility str PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name str
- Name of Container Registry namespace.
- auto
Create Boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility String PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name String
- Name of Container Registry namespace.
Outputs
All input properties are implicitly available as output properties. Additionally, the Namespace resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Namespace Resource
Get an existing Namespace resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NamespaceState, opts?: CustomResourceOptions): Namespace
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
auto_create: Optional[bool] = None,
default_visibility: Optional[str] = None,
name: Optional[str] = None) -> Namespace
func GetNamespace(ctx *Context, name string, id IDInput, state *NamespaceState, opts ...ResourceOption) (*Namespace, error)
public static Namespace Get(string name, Input<string> id, NamespaceState? state, CustomResourceOptions? opts = null)
public static Namespace get(String name, Output<String> id, NamespaceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Auto
Create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- Default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- Name string
- Name of Container Registry namespace.
- Auto
Create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- Default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- Name string
- Name of Container Registry namespace.
- auto
Create Boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility String PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name String
- Name of Container Registry namespace.
- auto
Create boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility string PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name string
- Name of Container Registry namespace.
- auto_
create bool - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default_
visibility str PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name str
- Name of Container Registry namespace.
- auto
Create Boolean - Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
- default
Visibility String PUBLIC
orPRIVATE
, default repository visibility in this namespace.- name String
- Name of Container Registry namespace.
Import
Container Registry namespace can be imported using the namespace, e.g.
$ pulumi import alicloud:cr/namespace:Namespace default my-namespace
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.