Cache Rule Args
An object that represents a cache rule for a container registry. Uses Azure REST API version 2024-11-01-preview. In version 2.x of the Azure Native provider, it used API version 2023-01-01-preview. Other available API versions: 2023-01-01-preview, 2023-06-01-preview, 2023-07-01, 2023-08-01-preview, 2023-11-01-preview, 2025-03-01-preview, 2025-04-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native containerregistry [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
CacheRuleCreate
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var cacheRule = new AzureNative.ContainerRegistry.CacheRule("cacheRule", new()
{
CacheRuleName = "myCacheRule",
CredentialSetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet",
RegistryName = "myRegistry",
ResourceGroupName = "myResourceGroup",
SourceRepository = "docker.io/library/hello-world",
TargetRepository = "cached-docker-hub/hello-world",
});
});
package main
import (
containerregistry "github.com/pulumi/pulumi-azure-native-sdk/containerregistry/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := containerregistry.NewCacheRule(ctx, "cacheRule", &containerregistry.CacheRuleArgs{
CacheRuleName: pulumi.String("myCacheRule"),
CredentialSetResourceId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"),
RegistryName: pulumi.String("myRegistry"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SourceRepository: pulumi.String("docker.io/library/hello-world"),
TargetRepository: pulumi.String("cached-docker-hub/hello-world"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.containerregistry.CacheRule;
import com.pulumi.azurenative.containerregistry.CacheRuleArgs;
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 cacheRule = new CacheRule("cacheRule", CacheRuleArgs.builder()
.cacheRuleName("myCacheRule")
.credentialSetResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet")
.registryName("myRegistry")
.resourceGroupName("myResourceGroup")
.sourceRepository("docker.io/library/hello-world")
.targetRepository("cached-docker-hub/hello-world")
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:containerregistry:CacheRule myCacheRule /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}
Properties
The name of the cache rule.
The ARM resource ID of the credential store which is associated with the cache rule.
The name of the container registry.
The name of the resource group. The name is case insensitive.
Source repository pulled from upstream.
Target repository specified in docker pull command. Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag}