Skip to content

Commit

Permalink
Export GCS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
eversC committed Nov 19, 2019
1 parent 9d3af25 commit 751fbd1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/location/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ import (

// Gcs type
type Gcs struct {
bucketName string
objectName string
fileType string
BucketName string
ObjectName string
FileType string
}

func (gcs Gcs) Write(serviceAccountName string, keyWrapper KeyWrapper, creds cred.Credentials) (updated UpdatedLocation, err error) {
var key string
if key, err = getKeyForFileBasedLocation(keyWrapper, gcs.fileType); err != nil {
if key, err = getKeyForFileBasedLocation(keyWrapper, gcs.FileType); err != nil {
return
}
ctx := context.Background()
var client *storage.Client
if client, err = storage.NewClient(ctx); err != nil {
return
}
bkt := client.Bucket(gcs.bucketName)
obj := bkt.Object(gcs.objectName)
bkt := client.Bucket(gcs.BucketName)
obj := bkt.Object(gcs.ObjectName)
w := obj.NewWriter(ctx)
if _, err = fmt.Fprintf(w, key); err != nil {
return
Expand All @@ -50,7 +50,7 @@ func (gcs Gcs) Write(serviceAccountName string, keyWrapper KeyWrapper, creds cre
}
updated = UpdatedLocation{
LocationType: "GCS",
LocationURI: gcs.bucketName,
LocationIDs: []string{gcs.objectName}}
LocationURI: gcs.BucketName,
LocationIDs: []string{gcs.ObjectName}}
return
}

0 comments on commit 751fbd1

Please sign in to comment.