1. Packages
  2. Ibm Provider
  3. API Docs
  4. CrRetentionPolicy
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.CrRetentionPolicy

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create, update, and delete about the IBM Cloud Container Registry retention policy resource. For more information, about IBM Cloud Container Registry retention policy, see Managing access for Container Registry.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const crRetentionPolicy = new ibm.CrRetentionPolicy("crRetentionPolicy", {
        imagesPerRepo: 10,
        namespace: "birds",
        retainUntagged: false,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    cr_retention_policy = ibm.CrRetentionPolicy("crRetentionPolicy",
        images_per_repo=10,
        namespace="birds",
        retain_untagged=False)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.NewCrRetentionPolicy(ctx, "crRetentionPolicy", &ibm.CrRetentionPolicyArgs{
    			ImagesPerRepo:  pulumi.Float64(10),
    			Namespace:      pulumi.String("birds"),
    			RetainUntagged: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var crRetentionPolicy = new Ibm.CrRetentionPolicy("crRetentionPolicy", new()
        {
            ImagesPerRepo = 10,
            Namespace = "birds",
            RetainUntagged = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.CrRetentionPolicy;
    import com.pulumi.ibm.CrRetentionPolicyArgs;
    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 crRetentionPolicy = new CrRetentionPolicy("crRetentionPolicy", CrRetentionPolicyArgs.builder()
                .imagesPerRepo(10)
                .namespace("birds")
                .retainUntagged(false)
                .build());
    
        }
    }
    
    resources:
      crRetentionPolicy:
        type: ibm:CrRetentionPolicy
        properties:
          imagesPerRepo: 10
          namespace: birds
          retainUntagged: false
    

    Create CrRetentionPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new CrRetentionPolicy(name: string, args: CrRetentionPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def CrRetentionPolicy(resource_name: str,
                          args: CrRetentionPolicyArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def CrRetentionPolicy(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          images_per_repo: Optional[float] = None,
                          namespace: Optional[str] = None,
                          cr_retention_policy_id: Optional[str] = None,
                          retain_untagged: Optional[bool] = None)
    func NewCrRetentionPolicy(ctx *Context, name string, args CrRetentionPolicyArgs, opts ...ResourceOption) (*CrRetentionPolicy, error)
    public CrRetentionPolicy(string name, CrRetentionPolicyArgs args, CustomResourceOptions? opts = null)
    public CrRetentionPolicy(String name, CrRetentionPolicyArgs args)
    public CrRetentionPolicy(String name, CrRetentionPolicyArgs args, CustomResourceOptions options)
    
    type: ibm:CrRetentionPolicy
    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 CrRetentionPolicyArgs
    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 CrRetentionPolicyArgs
    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 CrRetentionPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CrRetentionPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CrRetentionPolicyArgs
    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 crRetentionPolicyResource = new Ibm.CrRetentionPolicy("crRetentionPolicyResource", new()
    {
        ImagesPerRepo = 0,
        Namespace = "string",
        CrRetentionPolicyId = "string",
        RetainUntagged = false,
    });
    
    example, err := ibm.NewCrRetentionPolicy(ctx, "crRetentionPolicyResource", &ibm.CrRetentionPolicyArgs{
    	ImagesPerRepo:       pulumi.Float64(0),
    	Namespace:           pulumi.String("string"),
    	CrRetentionPolicyId: pulumi.String("string"),
    	RetainUntagged:      pulumi.Bool(false),
    })
    
    var crRetentionPolicyResource = new CrRetentionPolicy("crRetentionPolicyResource", CrRetentionPolicyArgs.builder()
        .imagesPerRepo(0)
        .namespace("string")
        .crRetentionPolicyId("string")
        .retainUntagged(false)
        .build());
    
    cr_retention_policy_resource = ibm.CrRetentionPolicy("crRetentionPolicyResource",
        images_per_repo=0,
        namespace="string",
        cr_retention_policy_id="string",
        retain_untagged=False)
    
    const crRetentionPolicyResource = new ibm.CrRetentionPolicy("crRetentionPolicyResource", {
        imagesPerRepo: 0,
        namespace: "string",
        crRetentionPolicyId: "string",
        retainUntagged: false,
    });
    
    type: ibm:CrRetentionPolicy
    properties:
        crRetentionPolicyId: string
        imagesPerRepo: 0
        namespace: string
        retainUntagged: false
    

    CrRetentionPolicy 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 CrRetentionPolicy resource accepts the following input properties:

    ImagesPerRepo double
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    Namespace string
    The namespace to which the retention policy is attached.
    CrRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    RetainUntagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    ImagesPerRepo float64
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    Namespace string
    The namespace to which the retention policy is attached.
    CrRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    RetainUntagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    imagesPerRepo Double
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace String
    The namespace to which the retention policy is attached.
    crRetentionPolicyId String
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    retainUntagged Boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    imagesPerRepo number
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace string
    The namespace to which the retention policy is attached.
    crRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    retainUntagged boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    images_per_repo float
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace str
    The namespace to which the retention policy is attached.
    cr_retention_policy_id str
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    retain_untagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    imagesPerRepo Number
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace String
    The namespace to which the retention policy is attached.
    crRetentionPolicyId String
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    retainUntagged Boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CrRetentionPolicy 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 CrRetentionPolicy Resource

    Get an existing CrRetentionPolicy 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?: CrRetentionPolicyState, opts?: CustomResourceOptions): CrRetentionPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cr_retention_policy_id: Optional[str] = None,
            images_per_repo: Optional[float] = None,
            namespace: Optional[str] = None,
            retain_untagged: Optional[bool] = None) -> CrRetentionPolicy
    func GetCrRetentionPolicy(ctx *Context, name string, id IDInput, state *CrRetentionPolicyState, opts ...ResourceOption) (*CrRetentionPolicy, error)
    public static CrRetentionPolicy Get(string name, Input<string> id, CrRetentionPolicyState? state, CustomResourceOptions? opts = null)
    public static CrRetentionPolicy get(String name, Output<String> id, CrRetentionPolicyState state, CustomResourceOptions options)
    resources:  _:    type: ibm:CrRetentionPolicy    get:      id: ${id}
    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.
    The following state arguments are supported:
    CrRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    ImagesPerRepo double
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    Namespace string
    The namespace to which the retention policy is attached.
    RetainUntagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    CrRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    ImagesPerRepo float64
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    Namespace string
    The namespace to which the retention policy is attached.
    RetainUntagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    crRetentionPolicyId String
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    imagesPerRepo Double
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace String
    The namespace to which the retention policy is attached.
    retainUntagged Boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    crRetentionPolicyId string
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    imagesPerRepo number
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace string
    The namespace to which the retention policy is attached.
    retainUntagged boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    cr_retention_policy_id str
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    images_per_repo float
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace str
    The namespace to which the retention policy is attached.
    retain_untagged bool
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.
    crRetentionPolicyId String
    The unique identifier of the cr_retention_policy. This identifier is the same as the name of namespace to which the retention policy is attached.
    imagesPerRepo Number
    Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained).
    namespace String
    The namespace to which the retention policy is attached.
    retainUntagged Boolean
    Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs.

    Import

    You can import the ibm_cr_retention_policy resource by adding the namespace option, where namespace is the namespace to which the retention policy is attached.

    $ pulumi import ibm:index/crRetentionPolicy:CrRetentionPolicy cr_retention_policy <namespace>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud