...

Source file src/edge-infra.dev/pkg/f8n/devinfra/gcp/job/storage/options.go

Documentation: edge-infra.dev/pkg/f8n/devinfra/gcp/job/storage

     1  package storage
     2  
     3  import gcs "cloud.google.com/go/storage"
     4  
     5  // Storage embeds a BucketHandle for the GCS bucket used to store job artifacts
     6  type Storage struct {
     7  	*gcs.Client
     8  }
     9  
    10  type Bucket struct {
    11  	*gcs.BucketHandle
    12  }
    13  
    14  // storageOpts is the internal options struct for creating a Storage struct
    15  type storageOpts struct {
    16  	client *gcs.Client
    17  }
    18  
    19  type bucketOpts struct {
    20  	bucketName string
    21  }
    22  
    23  // WithBucket allows setting the storage bucket name when creating a new Storage
    24  // struct
    25  func WithBucket(bucket string) BucketOption {
    26  	return func(o *bucketOpts) {
    27  		o.bucketName = bucket
    28  	}
    29  }
    30  
    31  // WithClient allows injecting an existing GCS Client
    32  func WithClient(c *gcs.Client) Option {
    33  	return func(o *storageOpts) {
    34  		o.client = c
    35  	}
    36  }
    37  

View as plain text