published on Thursday, Mar 12, 2026 by opentelekomcloud
published on Thursday, Mar 12, 2026 by opentelekomcloud
Up-to-date reference of API arguments for SWR image retention policy you can get at documentation portal
Manages the SWR image retention policy resource within Open Telekom Cloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as opentelekomcloud from "@pulumi/opentelekomcloud";
const config = new pulumi.Config();
const orgName = config.requireObject<any>("orgName");
const repoName = config.requireObject<any>("repoName");
const policy1 = new opentelekomcloud.SwrPolicyV2("policy_1", {
organization: orgName,
repository: repoName,
algorithm: "or",
rules: [{
template: "date_rule",
params: {
days: "30",
},
tagSelectors: [{
kind: "label",
pattern: "v1",
}],
}],
});
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud
config = pulumi.Config()
org_name = config.require_object("orgName")
repo_name = config.require_object("repoName")
policy1 = opentelekomcloud.SwrPolicyV2("policy_1",
organization=org_name,
repository=repo_name,
algorithm="or",
rules=[{
"template": "date_rule",
"params": {
"days": "30",
},
"tag_selectors": [{
"kind": "label",
"pattern": "v1",
}],
}])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
"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, "")
orgName := cfg.RequireObject("orgName")
repoName := cfg.RequireObject("repoName")
_, err := opentelekomcloud.NewSwrPolicyV2(ctx, "policy_1", &opentelekomcloud.SwrPolicyV2Args{
Organization: pulumi.Any(orgName),
Repository: pulumi.Any(repoName),
Algorithm: pulumi.String("or"),
Rules: opentelekomcloud.SwrPolicyV2RuleArray{
&opentelekomcloud.SwrPolicyV2RuleArgs{
Template: pulumi.String("date_rule"),
Params: pulumi.StringMap{
"days": pulumi.String("30"),
},
TagSelectors: opentelekomcloud.SwrPolicyV2RuleTagSelectorArray{
&opentelekomcloud.SwrPolicyV2RuleTagSelectorArgs{
Kind: pulumi.String("label"),
Pattern: pulumi.String("v1"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var orgName = config.RequireObject<dynamic>("orgName");
var repoName = config.RequireObject<dynamic>("repoName");
var policy1 = new Opentelekomcloud.SwrPolicyV2("policy_1", new()
{
Organization = orgName,
Repository = repoName,
Algorithm = "or",
Rules = new[]
{
new Opentelekomcloud.Inputs.SwrPolicyV2RuleArgs
{
Template = "date_rule",
Params =
{
{ "days", "30" },
},
TagSelectors = new[]
{
new Opentelekomcloud.Inputs.SwrPolicyV2RuleTagSelectorArgs
{
Kind = "label",
Pattern = "v1",
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.SwrPolicyV2;
import com.pulumi.opentelekomcloud.SwrPolicyV2Args;
import com.pulumi.opentelekomcloud.inputs.SwrPolicyV2RuleArgs;
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 orgName = config.get("orgName");
final var repoName = config.get("repoName");
var policy1 = new SwrPolicyV2("policy1", SwrPolicyV2Args.builder()
.organization(orgName)
.repository(repoName)
.algorithm("or")
.rules(SwrPolicyV2RuleArgs.builder()
.template("date_rule")
.params(Map.of("days", "30"))
.tagSelectors(SwrPolicyV2RuleTagSelectorArgs.builder()
.kind("label")
.pattern("v1")
.build())
.build())
.build());
}
}
configuration:
orgName:
type: dynamic
repoName:
type: dynamic
resources:
policy1:
type: opentelekomcloud:SwrPolicyV2
name: policy_1
properties:
organization: ${orgName}
repository: ${repoName}
algorithm: or
rules:
- template: date_rule
params:
days: '30'
tagSelectors:
- kind: label
pattern: v1
Create SwrPolicyV2 Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SwrPolicyV2(name: string, args: SwrPolicyV2Args, opts?: CustomResourceOptions);@overload
def SwrPolicyV2(resource_name: str,
args: SwrPolicyV2Args,
opts: Optional[ResourceOptions] = None)
@overload
def SwrPolicyV2(resource_name: str,
opts: Optional[ResourceOptions] = None,
algorithm: Optional[str] = None,
organization: Optional[str] = None,
repository: Optional[str] = None,
rules: Optional[Sequence[SwrPolicyV2RuleArgs]] = None,
swr_policy_v2_id: Optional[str] = None,
timeouts: Optional[SwrPolicyV2TimeoutsArgs] = None)func NewSwrPolicyV2(ctx *Context, name string, args SwrPolicyV2Args, opts ...ResourceOption) (*SwrPolicyV2, error)public SwrPolicyV2(string name, SwrPolicyV2Args args, CustomResourceOptions? opts = null)
public SwrPolicyV2(String name, SwrPolicyV2Args args)
public SwrPolicyV2(String name, SwrPolicyV2Args args, CustomResourceOptions options)
type: opentelekomcloud:SwrPolicyV2
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 SwrPolicyV2Args
- 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 SwrPolicyV2Args
- 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 SwrPolicyV2Args
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SwrPolicyV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SwrPolicyV2Args
- 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 swrPolicyV2Resource = new Opentelekomcloud.SwrPolicyV2("swrPolicyV2Resource", new()
{
Algorithm = "string",
Organization = "string",
Repository = "string",
Rules = new[]
{
new Opentelekomcloud.Inputs.SwrPolicyV2RuleArgs
{
Params =
{
{ "string", "string" },
},
TagSelectors = new[]
{
new Opentelekomcloud.Inputs.SwrPolicyV2RuleTagSelectorArgs
{
Kind = "string",
Pattern = "string",
},
},
Template = "string",
},
},
SwrPolicyV2Id = "string",
Timeouts = new Opentelekomcloud.Inputs.SwrPolicyV2TimeoutsArgs
{
Default = "string",
},
});
example, err := opentelekomcloud.NewSwrPolicyV2(ctx, "swrPolicyV2Resource", &opentelekomcloud.SwrPolicyV2Args{
Algorithm: pulumi.String("string"),
Organization: pulumi.String("string"),
Repository: pulumi.String("string"),
Rules: opentelekomcloud.SwrPolicyV2RuleArray{
&opentelekomcloud.SwrPolicyV2RuleArgs{
Params: pulumi.StringMap{
"string": pulumi.String("string"),
},
TagSelectors: opentelekomcloud.SwrPolicyV2RuleTagSelectorArray{
&opentelekomcloud.SwrPolicyV2RuleTagSelectorArgs{
Kind: pulumi.String("string"),
Pattern: pulumi.String("string"),
},
},
Template: pulumi.String("string"),
},
},
SwrPolicyV2Id: pulumi.String("string"),
Timeouts: &opentelekomcloud.SwrPolicyV2TimeoutsArgs{
Default: pulumi.String("string"),
},
})
var swrPolicyV2Resource = new SwrPolicyV2("swrPolicyV2Resource", SwrPolicyV2Args.builder()
.algorithm("string")
.organization("string")
.repository("string")
.rules(SwrPolicyV2RuleArgs.builder()
.params(Map.of("string", "string"))
.tagSelectors(SwrPolicyV2RuleTagSelectorArgs.builder()
.kind("string")
.pattern("string")
.build())
.template("string")
.build())
.swrPolicyV2Id("string")
.timeouts(SwrPolicyV2TimeoutsArgs.builder()
.default_("string")
.build())
.build());
swr_policy_v2_resource = opentelekomcloud.SwrPolicyV2("swrPolicyV2Resource",
algorithm="string",
organization="string",
repository="string",
rules=[{
"params": {
"string": "string",
},
"tag_selectors": [{
"kind": "string",
"pattern": "string",
}],
"template": "string",
}],
swr_policy_v2_id="string",
timeouts={
"default": "string",
})
const swrPolicyV2Resource = new opentelekomcloud.SwrPolicyV2("swrPolicyV2Resource", {
algorithm: "string",
organization: "string",
repository: "string",
rules: [{
params: {
string: "string",
},
tagSelectors: [{
kind: "string",
pattern: "string",
}],
template: "string",
}],
swrPolicyV2Id: "string",
timeouts: {
"default": "string",
},
});
type: opentelekomcloud:SwrPolicyV2
properties:
algorithm: string
organization: string
repository: string
rules:
- params:
string: string
tagSelectors:
- kind: string
pattern: string
template: string
swrPolicyV2Id: string
timeouts:
default: string
SwrPolicyV2 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 SwrPolicyV2 resource accepts the following input properties:
- Algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - Organization string
- Specifies the name of the repository organization.
- Repository string
- Specifies the name of the image repository.
- Rules
List<Swr
Policy V2Rule> Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- Swr
Policy stringV2Id - ID of the image retention policy.
- Timeouts
Swr
Policy V2Timeouts
- Algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - Organization string
- Specifies the name of the repository organization.
- Repository string
- Specifies the name of the image repository.
- Rules
[]Swr
Policy V2Rule Args Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- Swr
Policy stringV2Id - ID of the image retention policy.
- Timeouts
Swr
Policy V2Timeouts Args
- algorithm String
- Specifies the image retention policy matching rule. Accepted value:
or. - organization String
- Specifies the name of the repository organization.
- repository String
- Specifies the name of the image repository.
- rules
List<Swr
Policy V2Rule> Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- swr
Policy StringV2Id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts
- algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - organization string
- Specifies the name of the repository organization.
- repository string
- Specifies the name of the image repository.
- rules
Swr
Policy V2Rule[] Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- swr
Policy stringV2Id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts
- algorithm str
- Specifies the image retention policy matching rule. Accepted value:
or. - organization str
- Specifies the name of the repository organization.
- repository str
- Specifies the name of the image repository.
- rules
Sequence[Swr
Policy V2Rule Args] Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- swr_
policy_ strv2_ id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts Args
- algorithm String
- Specifies the image retention policy matching rule. Accepted value:
or. - organization String
- Specifies the name of the repository organization.
- repository String
- Specifies the name of the image repository.
- rules List<Property Map>
Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- swr
Policy StringV2Id - ID of the image retention policy.
- timeouts Property Map
Outputs
All input properties are implicitly available as output properties. Additionally, the SwrPolicyV2 resource produces the following output properties:
Look up Existing SwrPolicyV2 Resource
Get an existing SwrPolicyV2 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?: SwrPolicyV2State, opts?: CustomResourceOptions): SwrPolicyV2@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
algorithm: Optional[str] = None,
organization: Optional[str] = None,
repository: Optional[str] = None,
rules: Optional[Sequence[SwrPolicyV2RuleArgs]] = None,
scope: Optional[str] = None,
swr_policy_v2_id: Optional[str] = None,
timeouts: Optional[SwrPolicyV2TimeoutsArgs] = None) -> SwrPolicyV2func GetSwrPolicyV2(ctx *Context, name string, id IDInput, state *SwrPolicyV2State, opts ...ResourceOption) (*SwrPolicyV2, error)public static SwrPolicyV2 Get(string name, Input<string> id, SwrPolicyV2State? state, CustomResourceOptions? opts = null)public static SwrPolicyV2 get(String name, Output<String> id, SwrPolicyV2State state, CustomResourceOptions options)resources: _: type: opentelekomcloud:SwrPolicyV2 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.
- Algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - Organization string
- Specifies the name of the repository organization.
- Repository string
- Specifies the name of the image repository.
- Rules
List<Swr
Policy V2Rule> Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- Scope string
- Swr
Policy stringV2Id - ID of the image retention policy.
- Timeouts
Swr
Policy V2Timeouts
- Algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - Organization string
- Specifies the name of the repository organization.
- Repository string
- Specifies the name of the image repository.
- Rules
[]Swr
Policy V2Rule Args Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- Scope string
- Swr
Policy stringV2Id - ID of the image retention policy.
- Timeouts
Swr
Policy V2Timeouts Args
- algorithm String
- Specifies the image retention policy matching rule. Accepted value:
or. - organization String
- Specifies the name of the repository organization.
- repository String
- Specifies the name of the image repository.
- rules
List<Swr
Policy V2Rule> Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- scope String
- swr
Policy StringV2Id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts
- algorithm string
- Specifies the image retention policy matching rule. Accepted value:
or. - organization string
- Specifies the name of the repository organization.
- repository string
- Specifies the name of the image repository.
- rules
Swr
Policy V2Rule[] Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- scope string
- swr
Policy stringV2Id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts
- algorithm str
- Specifies the image retention policy matching rule. Accepted value:
or. - organization str
- Specifies the name of the repository organization.
- repository str
- Specifies the name of the image repository.
- rules
Sequence[Swr
Policy V2Rule Args] Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- scope str
- swr_
policy_ strv2_ id - ID of the image retention policy.
- timeouts
Swr
Policy V2Timeouts Args
- algorithm String
- Specifies the image retention policy matching rule. Accepted value:
or. - organization String
- Specifies the name of the repository organization.
- repository String
- Specifies the name of the image repository.
- rules List<Property Map>
Specifies the image retention policy. The rules structure is documented below.
The
rulesblock supports:- scope String
- swr
Policy StringV2Id - ID of the image retention policy.
- timeouts Property Map
Supporting Types
SwrPolicyV2Rule, SwrPolicyV2RuleArgs
- Params Dictionary<string, string>
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. -
List<Swr
Policy V2Rule Tag Selector> - Specifies the exception images. The structure is documented below.
- Template string
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
- Params map[string]string
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. -
[]Swr
Policy V2Rule Tag Selector - Specifies the exception images. The structure is documented below.
- Template string
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
- params Map<String,String>
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. -
List<Swr
Policy V2Rule Tag Selector> - Specifies the exception images. The structure is documented below.
- template String
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
- params {[key: string]: string}
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. -
Swr
Policy V2Rule Tag Selector[] - Specifies the exception images. The structure is documented below.
- template string
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
- params Mapping[str, str]
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. - tag_
selectors Sequence[SwrPolicy V2Rule Tag Selector] - Specifies the exception images. The structure is documented below.
- template str
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
- params Map<String>
- Specifies the image retention policy parameters. If
templateis set todate_rule, setparamsto{ days = "xxx" }. If template is set totag_rule, setparamsto{ num = "xxx" }. - List<Property Map>
- Specifies the exception images. The structure is documented below.
- template String
- Specifies the image retention policy type. Acceped values:
date_rule,tag_rule.
SwrPolicyV2RuleTagSelector, SwrPolicyV2RuleTagSelectorArgs
SwrPolicyV2Timeouts, SwrPolicyV2TimeoutsArgs
- Default string
- Default string
- default_ String
- default string
- default str
- default String
Import
SWR image retention policy can be imported using the organization name <org_name>, repository name <repo_name>, and policy ID <id>, e.g.
$ pulumi import opentelekomcloud:index/swrPolicyV2:SwrPolicyV2 policy_1 <org_name>/<repo_name>/<id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- opentelekomcloud opentelekomcloud/terraform-provider-opentelekomcloud
- License
- Notes
- This Pulumi package is based on the
opentelekomcloudTerraform Provider.
published on Thursday, Mar 12, 2026 by opentelekomcloud
