1. Packages
  2. Harbor
  3. API Docs
  4. RetentionPolicy
Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse

harbor.RetentionPolicy

Explore with Pulumi AI

harbor logo
Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse

    Example Usage

    resource "harbor_project" "main" {
      name                = "acctest"
    }
    
    resource "harbor_retention_policy" "main" {
    	scope = harbor_project.main.id
    	schedule = "Daily"
    	rule {
    		n_days_since_last_pull = 5
    		repo_matching = "**"
    		tag_matching = "latest"
    	}
    	rule {
    		n_days_since_last_push = 10
    		repo_matching = "**"
    		tag_matching = "{latest,snapshot}"
    	}
    
    }
    

    Create RetentionPolicy Resource

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

    Constructor syntax

    new RetentionPolicy(name: string, args: RetentionPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def RetentionPolicy(resource_name: str,
                        args: RetentionPolicyArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def RetentionPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        rules: Optional[Sequence[RetentionPolicyRuleArgs]] = None,
                        scope: Optional[str] = None,
                        schedule: Optional[str] = None)
    func NewRetentionPolicy(ctx *Context, name string, args RetentionPolicyArgs, opts ...ResourceOption) (*RetentionPolicy, error)
    public RetentionPolicy(string name, RetentionPolicyArgs args, CustomResourceOptions? opts = null)
    public RetentionPolicy(String name, RetentionPolicyArgs args)
    public RetentionPolicy(String name, RetentionPolicyArgs args, CustomResourceOptions options)
    
    type: harbor:RetentionPolicy
    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 RetentionPolicyArgs
    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 RetentionPolicyArgs
    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 RetentionPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RetentionPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RetentionPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var retentionPolicyResource = new Harbor.RetentionPolicy("retentionPolicyResource", new()
    {
        Rules = new[]
        {
            new Harbor.Inputs.RetentionPolicyRuleArgs
            {
                AlwaysRetain = false,
                Disabled = false,
                MostRecentlyPulled = 0,
                MostRecentlyPushed = 0,
                NDaysSinceLastPull = 0,
                NDaysSinceLastPush = 0,
                RepoExcluding = "string",
                RepoMatching = "string",
                TagExcluding = "string",
                TagMatching = "string",
                UntaggedArtifacts = false,
            },
        },
        Scope = "string",
        Schedule = "string",
    });
    
    example, err := harbor.NewRetentionPolicy(ctx, "retentionPolicyResource", &harbor.RetentionPolicyArgs{
    	Rules: harbor.RetentionPolicyRuleArray{
    		&harbor.RetentionPolicyRuleArgs{
    			AlwaysRetain:       pulumi.Bool(false),
    			Disabled:           pulumi.Bool(false),
    			MostRecentlyPulled: pulumi.Int(0),
    			MostRecentlyPushed: pulumi.Int(0),
    			NDaysSinceLastPull: pulumi.Int(0),
    			NDaysSinceLastPush: pulumi.Int(0),
    			RepoExcluding:      pulumi.String("string"),
    			RepoMatching:       pulumi.String("string"),
    			TagExcluding:       pulumi.String("string"),
    			TagMatching:        pulumi.String("string"),
    			UntaggedArtifacts:  pulumi.Bool(false),
    		},
    	},
    	Scope:    pulumi.String("string"),
    	Schedule: pulumi.String("string"),
    })
    
    var retentionPolicyResource = new RetentionPolicy("retentionPolicyResource", RetentionPolicyArgs.builder()        
        .rules(RetentionPolicyRuleArgs.builder()
            .alwaysRetain(false)
            .disabled(false)
            .mostRecentlyPulled(0)
            .mostRecentlyPushed(0)
            .nDaysSinceLastPull(0)
            .nDaysSinceLastPush(0)
            .repoExcluding("string")
            .repoMatching("string")
            .tagExcluding("string")
            .tagMatching("string")
            .untaggedArtifacts(false)
            .build())
        .scope("string")
        .schedule("string")
        .build());
    
    retention_policy_resource = harbor.RetentionPolicy("retentionPolicyResource",
        rules=[harbor.RetentionPolicyRuleArgs(
            always_retain=False,
            disabled=False,
            most_recently_pulled=0,
            most_recently_pushed=0,
            n_days_since_last_pull=0,
            n_days_since_last_push=0,
            repo_excluding="string",
            repo_matching="string",
            tag_excluding="string",
            tag_matching="string",
            untagged_artifacts=False,
        )],
        scope="string",
        schedule="string")
    
    const retentionPolicyResource = new harbor.RetentionPolicy("retentionPolicyResource", {
        rules: [{
            alwaysRetain: false,
            disabled: false,
            mostRecentlyPulled: 0,
            mostRecentlyPushed: 0,
            nDaysSinceLastPull: 0,
            nDaysSinceLastPush: 0,
            repoExcluding: "string",
            repoMatching: "string",
            tagExcluding: "string",
            tagMatching: "string",
            untaggedArtifacts: false,
        }],
        scope: "string",
        schedule: "string",
    });
    
    type: harbor:RetentionPolicy
    properties:
        rules:
            - alwaysRetain: false
              disabled: false
              mostRecentlyPulled: 0
              mostRecentlyPushed: 0
              nDaysSinceLastPull: 0
              nDaysSinceLastPush: 0
              repoExcluding: string
              repoMatching: string
              tagExcluding: string
              tagMatching: string
              untaggedArtifacts: false
        schedule: string
        scope: string
    

    RetentionPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The RetentionPolicy resource accepts the following input properties:

    Rules List<Pulumiverse.Harbor.Inputs.RetentionPolicyRule>
    Al collection of rule blocks as documented below.
    Scope string
    The project id of which you would like to apply this policy.
    Schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    Rules []RetentionPolicyRuleArgs
    Al collection of rule blocks as documented below.
    Scope string
    The project id of which you would like to apply this policy.
    Schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    rules List<RetentionPolicyRule>
    Al collection of rule blocks as documented below.
    scope String
    The project id of which you would like to apply this policy.
    schedule String
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    rules RetentionPolicyRule[]
    Al collection of rule blocks as documented below.
    scope string
    The project id of which you would like to apply this policy.
    schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    rules Sequence[RetentionPolicyRuleArgs]
    Al collection of rule blocks as documented below.
    scope str
    The project id of which you would like to apply this policy.
    schedule str
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    rules List<Property Map>
    Al collection of rule blocks as documented below.
    scope String
    The project id of which you would like to apply this policy.
    schedule String
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.

    Outputs

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

    Get an existing RetentionPolicy 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?: RetentionPolicyState, opts?: CustomResourceOptions): RetentionPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            rules: Optional[Sequence[RetentionPolicyRuleArgs]] = None,
            schedule: Optional[str] = None,
            scope: Optional[str] = None) -> RetentionPolicy
    func GetRetentionPolicy(ctx *Context, name string, id IDInput, state *RetentionPolicyState, opts ...ResourceOption) (*RetentionPolicy, error)
    public static RetentionPolicy Get(string name, Input<string> id, RetentionPolicyState? state, CustomResourceOptions? opts = null)
    public static RetentionPolicy get(String name, Output<String> id, RetentionPolicyState 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.
    The following state arguments are supported:
    Rules List<Pulumiverse.Harbor.Inputs.RetentionPolicyRule>
    Al collection of rule blocks as documented below.
    Schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    Scope string
    The project id of which you would like to apply this policy.
    Rules []RetentionPolicyRuleArgs
    Al collection of rule blocks as documented below.
    Schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    Scope string
    The project id of which you would like to apply this policy.
    rules List<RetentionPolicyRule>
    Al collection of rule blocks as documented below.
    schedule String
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    scope String
    The project id of which you would like to apply this policy.
    rules RetentionPolicyRule[]
    Al collection of rule blocks as documented below.
    schedule string
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    scope string
    The project id of which you would like to apply this policy.
    rules Sequence[RetentionPolicyRuleArgs]
    Al collection of rule blocks as documented below.
    schedule str
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    scope str
    The project id of which you would like to apply this policy.
    rules List<Property Map>
    Al collection of rule blocks as documented below.
    schedule String
    The schedule of when you would like the policy to run. This can be Hourly, Daily, Weekly or can be a custom cron string.
    scope String
    The project id of which you would like to apply this policy.

    Supporting Types

    RetentionPolicyRule, RetentionPolicyRuleArgs

    AlwaysRetain bool
    retain always.
    Disabled bool
    Specify if the rule is disable or not. Defaults to false
    MostRecentlyPulled int
    retain the most recently pulled n artifacts.
    MostRecentlyPushed int
    retain the most recently pushed n artifacts.
    NDaysSinceLastPull int
    retains the artifacts pulled within the lasts n days.
    NDaysSinceLastPush int
    retains the artifacts pushed within the lasts n days.
    RepoExcluding string
    For the repositories excuding.
    RepoMatching string
    For the repositories matching.
    TagExcluding string
    For the tag excuding.
    TagMatching string
    For the tag matching.
    UntaggedArtifacts bool

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    AlwaysRetain bool
    retain always.
    Disabled bool
    Specify if the rule is disable or not. Defaults to false
    MostRecentlyPulled int
    retain the most recently pulled n artifacts.
    MostRecentlyPushed int
    retain the most recently pushed n artifacts.
    NDaysSinceLastPull int
    retains the artifacts pulled within the lasts n days.
    NDaysSinceLastPush int
    retains the artifacts pushed within the lasts n days.
    RepoExcluding string
    For the repositories excuding.
    RepoMatching string
    For the repositories matching.
    TagExcluding string
    For the tag excuding.
    TagMatching string
    For the tag matching.
    UntaggedArtifacts bool

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    alwaysRetain Boolean
    retain always.
    disabled Boolean
    Specify if the rule is disable or not. Defaults to false
    mostRecentlyPulled Integer
    retain the most recently pulled n artifacts.
    mostRecentlyPushed Integer
    retain the most recently pushed n artifacts.
    nDaysSinceLastPull Integer
    retains the artifacts pulled within the lasts n days.
    nDaysSinceLastPush Integer
    retains the artifacts pushed within the lasts n days.
    repoExcluding String
    For the repositories excuding.
    repoMatching String
    For the repositories matching.
    tagExcluding String
    For the tag excuding.
    tagMatching String
    For the tag matching.
    untaggedArtifacts Boolean

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    alwaysRetain boolean
    retain always.
    disabled boolean
    Specify if the rule is disable or not. Defaults to false
    mostRecentlyPulled number
    retain the most recently pulled n artifacts.
    mostRecentlyPushed number
    retain the most recently pushed n artifacts.
    nDaysSinceLastPull number
    retains the artifacts pulled within the lasts n days.
    nDaysSinceLastPush number
    retains the artifacts pushed within the lasts n days.
    repoExcluding string
    For the repositories excuding.
    repoMatching string
    For the repositories matching.
    tagExcluding string
    For the tag excuding.
    tagMatching string
    For the tag matching.
    untaggedArtifacts boolean

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    always_retain bool
    retain always.
    disabled bool
    Specify if the rule is disable or not. Defaults to false
    most_recently_pulled int
    retain the most recently pulled n artifacts.
    most_recently_pushed int
    retain the most recently pushed n artifacts.
    n_days_since_last_pull int
    retains the artifacts pulled within the lasts n days.
    n_days_since_last_push int
    retains the artifacts pushed within the lasts n days.
    repo_excluding str
    For the repositories excuding.
    repo_matching str
    For the repositories matching.
    tag_excluding str
    For the tag excuding.
    tag_matching str
    For the tag matching.
    untagged_artifacts bool

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    alwaysRetain Boolean
    retain always.
    disabled Boolean
    Specify if the rule is disable or not. Defaults to false
    mostRecentlyPulled Number
    retain the most recently pulled n artifacts.
    mostRecentlyPushed Number
    retain the most recently pushed n artifacts.
    nDaysSinceLastPull Number
    retains the artifacts pulled within the lasts n days.
    nDaysSinceLastPush Number
    retains the artifacts pushed within the lasts n days.
    repoExcluding String
    For the repositories excuding.
    repoMatching String
    For the repositories matching.
    tagExcluding String
    For the tag excuding.
    tagMatching String
    For the tag matching.
    untaggedArtifacts Boolean

    with untagged artifacts. Defaults to true

    Multiple tags or repositories must be provided as a comma-separated list wrapped into curly brackets { }. Otherwise, the value is interpreted as a single value.

    Import

    Harbor retention policy can be imported using the retention_policy id eg, <break><break> ```sh<break> $ pulumi import harbor:index/retentionPolicy:RetentionPolicy main /retentions/10 <break>```<break><break>

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

    Package Details

    Repository
    harbor pulumiverse/pulumi-harbor
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harbor Terraform Provider.
    harbor logo
    Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse