harbor.RetentionPolicy
Explore with Pulumi AI
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
new RetentionPolicy(name: string, args: RetentionPolicyArgs, opts?: CustomResourceOptions);
@overload
def RetentionPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
rules: Optional[Sequence[RetentionPolicyRuleArgs]] = None,
schedule: Optional[str] = None,
scope: Optional[str] = None)
@overload
def RetentionPolicy(resource_name: str,
args: RetentionPolicyArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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. Retention Policy Rule> 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
[]Retention
Policy Rule Args 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<Retention
Policy Rule> 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
Retention
Policy Rule[] 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[Retention
Policy Rule Args] 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.
- Rules
List<Pulumiverse.
Harbor. Inputs. Retention Policy Rule> 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
[]Retention
Policy Rule Args 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<Retention
Policy Rule> 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
Retention
Policy Rule[] 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[Retention
Policy Rule Args] 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
- Always
Retain bool retain always.
- Disabled bool
Specify if the rule is disable or not. Defaults to
false
- Most
Recently intPulled retain the most recently pulled n artifacts.
- Most
Recently intPushed retain the most recently pushed n artifacts.
- NDays
Since intLast Pull retains the artifacts pulled within the lasts n days.
- NDays
Since intLast Push retains the artifacts pushed within the lasts n days.
- Repo
Excluding string For the repositories excuding.
- Repo
Matching string For the repositories matching.
- Tag
Excluding string For the tag excuding.
- Tag
Matching string 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.
- Always
Retain bool retain always.
- Disabled bool
Specify if the rule is disable or not. Defaults to
false
- Most
Recently intPulled retain the most recently pulled n artifacts.
- Most
Recently intPushed retain the most recently pushed n artifacts.
- NDays
Since intLast Pull retains the artifacts pulled within the lasts n days.
- NDays
Since intLast Push retains the artifacts pushed within the lasts n days.
- Repo
Excluding string For the repositories excuding.
- Repo
Matching string For the repositories matching.
- Tag
Excluding string For the tag excuding.
- Tag
Matching string 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.
- always
Retain Boolean retain always.
- disabled Boolean
Specify if the rule is disable or not. Defaults to
false
- most
Recently IntegerPulled retain the most recently pulled n artifacts.
- most
Recently IntegerPushed retain the most recently pushed n artifacts.
- n
Days IntegerSince Last Pull retains the artifacts pulled within the lasts n days.
- n
Days IntegerSince Last Push retains the artifacts pushed within the lasts n days.
- repo
Excluding String For the repositories excuding.
- repo
Matching String For the repositories matching.
- tag
Excluding String For the tag excuding.
- tag
Matching String For the tag matching.
- untagged
Artifacts 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 boolean retain always.
- disabled boolean
Specify if the rule is disable or not. Defaults to
false
- most
Recently numberPulled retain the most recently pulled n artifacts.
- most
Recently numberPushed retain the most recently pushed n artifacts.
- n
Days numberSince Last Pull retains the artifacts pulled within the lasts n days.
- n
Days numberSince Last Push retains the artifacts pushed within the lasts n days.
- repo
Excluding string For the repositories excuding.
- repo
Matching string For the repositories matching.
- tag
Excluding string For the tag excuding.
- tag
Matching string For the tag matching.
- untagged
Artifacts 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_ intpulled retain the most recently pulled n artifacts.
- most_
recently_ intpushed retain the most recently pushed n artifacts.
- n_
days_ intsince_ last_ pull retains the artifacts pulled within the lasts n days.
- n_
days_ intsince_ last_ push 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.
- always
Retain Boolean retain always.
- disabled Boolean
Specify if the rule is disable or not. Defaults to
false
- most
Recently NumberPulled retain the most recently pulled n artifacts.
- most
Recently NumberPushed retain the most recently pushed n artifacts.
- n
Days NumberSince Last Pull retains the artifacts pulled within the lasts n days.
- n
Days NumberSince Last Push retains the artifacts pushed within the lasts n days.
- repo
Excluding String For the repositories excuding.
- repo
Matching String For the repositories matching.
- tag
Excluding String For the tag excuding.
- tag
Matching String For the tag matching.
- untagged
Artifacts 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>
Package Details
- Repository
- harbor pulumiverse/pulumi-harbor
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
harbor
Terraform Provider.