AnywhereCache class

The Google Cloud Storage (GCS) Anywhere Cache feature allows users to create SSD backed zonal read cache for their buckets. These zonal caches are co-located with the customers compute engines to provide cost efficiency.

Example Usage

Storage Anywhere Cache Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumiverse/time";

const bucket = new gcp.storage.Bucket("bucket", {
    name: "bucket-name",
    location: "US",
});
const destroyWait5000Seconds = new time.Sleep("destroy_wait_5000_seconds", {destroyDuration: "5000s"}, {
    dependsOn: [bucket],
});
const cache = new gcp.storage.AnywhereCache("cache", {
    bucket: bucket.name,
    zone: "us-central1-f",
    ttl: "3601s",
}, {
    dependsOn: [destroyWait5000Seconds],
});
import pulumi
import pulumi_gcp as gcp
import pulumiverse_time as time

bucket = gcp.storage.Bucket("bucket",
    name="bucket-name",
    location="US")
destroy_wait5000_seconds = time.Sleep("destroy_wait_5000_seconds", destroy_duration="5000s",
opts = pulumi.ResourceOptions(depends_on=[bucket]))
cache = gcp.storage.AnywhereCache("cache",
    bucket=bucket.name,
    zone="us-central1-f",
    ttl="3601s",
    opts = pulumi.ResourceOptions(depends_on=[destroy_wait5000_seconds]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumiverse.Time;

return await Deployment.RunAsync(() =>
{
    var bucket = new Gcp.Storage.Bucket("bucket", new()
    {
        Name = "bucket-name",
        Location = "US",
    });

    var destroyWait5000Seconds = new Time.Sleep("destroy_wait_5000_seconds", new()
    {
        DestroyDuration = "5000s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            bucket,
        },
    });

    var cache = new Gcp.Storage.AnywhereCache("cache", new()
    {
        Bucket = bucket.Name,
        Zone = "us-central1-f",
        Ttl = "3601s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            destroyWait5000Seconds,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-time/sdk/go/time"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
			Name:     pulumi.String("bucket-name"),
			Location: pulumi.String("US"),
		})
		if err != nil {
			return err
		}
		destroyWait5000Seconds, err := time.NewSleep(ctx, "destroy_wait_5000_seconds", &time.SleepArgs{
			DestroyDuration: pulumi.String("5000s"),
		}, pulumi.DependsOn([]pulumi.Resource{
			bucket,
		}))
		if err != nil {
			return err
		}
		_, err = storage.NewAnywhereCache(ctx, "cache", &storage.AnywhereCacheArgs{
			Bucket: bucket.Name,
			Zone:   pulumi.String("us-central1-f"),
			Ttl:    pulumi.String("3601s"),
		}, pulumi.DependsOn([]pulumi.Resource{
			destroyWait5000Seconds,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
    time = {
      source = "pulumi/time"
    }
  }
}

resource "gcp_storage_bucket" "bucket" {
  name     = "bucket-name"
  location = "US"
}
resource "time_sleep" "destroy_wait_5000_seconds" {
  depends_on       = [gcp_storage_bucket.bucket]
  destroy_duration = "5000s"
}
resource "gcp_storage_anywherecache" "cache" {
  depends_on = [time_sleep.destroy_wait_5000_seconds]
  bucket     = gcp_storage_bucket.bucket.name
  zone       = "us-central1-f"
  ttl        = "3601s"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumiverse.time.Sleep;
import com.pulumiverse.time.SleepArgs;
import com.pulumi.gcp.storage.AnywhereCache;
import com.pulumi.gcp.storage.AnywhereCacheArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 bucket = new Bucket("bucket", BucketArgs.builder()
            .name("bucket-name")
            .location("US")
            .build());

        var destroyWait5000Seconds = new Sleep("destroyWait5000Seconds", SleepArgs.builder()
            .destroyDuration("5000s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(bucket)
                .build());

        var cache = new AnywhereCache("cache", AnywhereCacheArgs.builder()
            .bucket(bucket.name())
            .zone("us-central1-f")
            .ttl("3601s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(destroyWait5000Seconds)
                .build());

    }
}
resources:
  bucket:
    type: gcp:storage:Bucket
    properties:
      name: bucket-name
      location: US
  destroyWait5000Seconds:
    type: time:Sleep
    name: destroy_wait_5000_seconds
    properties:
      destroyDuration: 5000s
    options:
      dependsOn:
        - ${bucket}
  cache:
    type: gcp:storage:AnywhereCache
    properties:
      bucket: ${bucket.name}
      zone: us-central1-f
      ttl: 3601s
    options:
      dependsOn:
        - ${destroyWait5000Seconds}

Import

AnywhereCache can be imported using any of these accepted formats:

  • b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
  • {{bucket}}/{{anywhere_cache_id}}

When using the pulumi import command, AnywhereCache can be imported using one of the formats above. For example:

$ pulumi import gcp:storage/anywhereCache:AnywhereCache default b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
$ pulumi import gcp:storage/anywhereCache:AnywhereCache default {{bucket}}/{{anywhere_cache_id}}

Constructors

AnywhereCache(String name, {AnywhereCacheArgs? args, CustomResourceOptions? options})
Creates a new AnywhereCache. name The Pulumi resource name. args Arguments used to configure this AnywhereCache. The set of arguments for AnywhereCache. options Resource options controlling this resource's behavior.
AnywhereCache.reference(String urn)
Creates a typed reference to an existing AnywhereCache resource.

Properties

admissionPolicy ↔ Output<String?>
(Optional, Deprecated) The cache admission policy dictates whether a block should be inserted upon a cache miss. Note: "admit-on-second-miss" is deprecated and will fallback to "admit-on-first-miss". Default value is admit-on-first-miss. Possible values are: admit-on-first-miss, admit-on-second-miss.
latefinal
anywhereCacheId ↔ Output<String>
The ID of the Anywhere cache instance.
latefinal
bucket ↔ Output<String>
A reference to Bucket resource
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<String>
The creation time of the cache instance in RFC 3339 format.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
ingestOnWrite ↔ Output<bool?>
Whether or not the cache ingests data as the data is written to the bucket.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
pendingUpdate ↔ Output<bool>
True if the cache instance has an active Update long-running operation.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ Output<String>
The current state of the cache instance.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
ttl ↔ Output<String?>
The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
latefinal
updateTime ↔ Output<String>
The modification time of the cache instance metadata in RFC 3339 format.
latefinal
urn ↔ Output<String>
latefinalinherited
zone ↔ Output<String>
The zone in which the cache instance needs to be created. For example, us-central1-a.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AnywhereCacheState? state, CustomResourceOptions? options}) → AnywhereCache
Gets an existing AnywhereCache resource's state with the given name and id.