C# Class Google.PowerShell.CloudStorage.GoogleCloudStorageProvider

Inheritance: System.Management.Automation.Provider.NavigationCmdletProvider, IContentCmdletProvider
ファイルを表示 Open project: GoogleCloudPlatform/google-cloud-powershell

Private Properties

Property Type Description
DeleteObjects void
GetBucketModel BucketModel
GetChildItemBucketHelper void
GetContentStream Stream
GetNewService StorageService
ListAllProjects IEnumerable
ListBucketsAsync System.Threading.Tasks.Task
ListChildren IEnumerable
NewBucket Bucket
NewObject Google.Apis.Storage.v1.Data.Object
NewTelemetryReporter IReportCmdletResults
PerformActionOnBucketAndOptionallyUpdateCache void
RemoveBucket void
RemoveFolder void
UpdateBucketCacheAndPerformActionOnBucket Bucket>.Dictionary
WaitDeleteTasks void

Public Methods

Method Description
ClearContent ( string path ) : void

Clears the content of an object. Used by Clear-Content.

ClearContentDynamicParameters ( string path ) : object
GetContentReader ( string path ) : IContentReader

Gets a content reader to read the contents of a downloaded Google Cloud Storage object. Used by Get-Contents.

GetContentReaderDynamicParameters ( string path ) : object

Required by IContentCmdletProvider, along with GetContentReader(string). Returns null because we have no need for dynamic parameters on Get-Content.

GetContentWriter ( string path ) : IContentWriter

Gets a writer used to upload data to a Google Cloud Storage object. Used by Set-Content.

GetContentWriterDynamicParameters ( string path ) : object

Protected Methods

Method Description
CopyItem ( string path, string copyPath, bool recurse ) : void

Copies a Google Cloud Storage object or folder to another object or folder. Used by Copy-Item.

CopyItemDynamicParameters ( string path, string destination, bool recurse ) : object
GetChildItems ( string path, bool recurse ) : void

Writes the object descriptions of the items in the container to the output. Used by Get-ChildItem.

GetChildNames ( string path, ReturnContainers returnContainers ) : void

Writes the names of the children of the container to the output. Used for tab-completion.

GetItem ( string path ) : void

Writes the object describing the item to the output. Used by Get-Item.

HasChildItems ( string path ) : bool

Checks if a container actually contains items.

InitializeDefaultDrives ( ) : Collection

Creates a default Google Cloud Storage drive named gs.

IsItemContainer ( string path ) : bool

PowerShell uses this to check if an item is a container. All drives, all buckets, objects that end with "/", and prefixes to objects are containers.

IsValidPath ( string path ) : bool

Checks if a path is a legal string of characters. Shoudl pretty much always return null.

ItemExists ( string path ) : bool

PowerShell uses this to check if items exist.

NewItem ( string path, string itemTypeName, object newItemValue ) : void

Creates a new item at the given path.

NewItemDynamicParameters ( string path, string itemTypeName, object newItemValue ) : object
RemoveItem ( string path, bool recurse ) : void

Deletes a Google Cloud Storage object or bucket. Used by Remove-Item.

RemoveItemDynamicParameters ( string path, bool recurse ) : object
Stop ( ) : void

Dispose the resources used by the provider. Specifically the services.

Private Methods

Method Description
DeleteObjects ( GcsPath gcsPath ) : void
GetBucketModel ( string bucket ) : BucketModel
GetChildItemBucketHelper ( Bucket bucket, bool recurse ) : void

Write out a bucket to the command line. If recurse is set to true, call GetChildItems on the bucket to process its children.

GetContentStream ( object newItemValue, NewGcsObjectDynamicParameters dynamicParameters ) : Stream
GetNewService ( ) : StorageService

This methods returns a new storage service.

ListAllProjects ( ) : IEnumerable
ListBucketsAsync ( Project project, BlockingCollection collections ) : System.Threading.Tasks.Task

Retrieves all buckets from the specified project and adding them to the blocking collection.

ListChildren ( GcsPath gcsPath, bool recurse, bool allPages = true ) : IEnumerable
NewBucket ( GcsPath gcsPath, NewGcsBucketDynamicParameters dynamicParams ) : Bucket
NewObject ( GcsPath gcsPath, NewGcsObjectDynamicParameters dynamicParameters, Stream contentStream ) : Google.Apis.Storage.v1.Data.Object
NewTelemetryReporter ( ) : IReportCmdletResults
PerformActionOnBucketAndOptionallyUpdateCache ( Action actionOnBucket ) : void

If the BucketCache is not out of date, simply perform the action on each bucket. Otherwise, we update the cache and perform the action while doing that (for example, we can write the bucket to the command line as they become available instead of writing all at once).

RemoveBucket ( GcsPath gcsPath, bool removeObjects ) : void
RemoveFolder ( GcsPath gcsPath, bool recurse ) : void
UpdateBucketCacheAndPerformActionOnBucket ( Action action ) : Bucket>.Dictionary

Update BucketCache and perform action on each of the bucket while doing so.

WaitDeleteTasks ( List deleteTasks ) : void

Waits on the list of delete tasks to compelete, updating progress as it does so.

Method Details

ClearContent() public method

Clears the content of an object. Used by Clear-Content.
public ClearContent ( string path ) : void
path string The path of the object to clear.
return void

ClearContentDynamicParameters() public method

public ClearContentDynamicParameters ( string path ) : object
path string
return object

CopyItem() protected method

Copies a Google Cloud Storage object or folder to another object or folder. Used by Copy-Item.
protected CopyItem ( string path, string copyPath, bool recurse ) : void
path string The path to copy from.
copyPath string The path to copy to.
recurse bool If true, will copy all decendent objects as well.
return void

CopyItemDynamicParameters() protected method

protected CopyItemDynamicParameters ( string path, string destination, bool recurse ) : object
path string
destination string
recurse bool
return object

GetChildItems() protected method

Writes the object descriptions of the items in the container to the output. Used by Get-ChildItem.
protected GetChildItems ( string path, bool recurse ) : void
path string The path of the container.
recurse bool If true, get all descendents of the container, not just immediate children.
return void

GetChildNames() protected method

Writes the names of the children of the container to the output. Used for tab-completion.
protected GetChildNames ( string path, ReturnContainers returnContainers ) : void
path string The path to the container to get the children of.
returnContainers ReturnContainers The names of the children of the container.
return void

GetContentReader() public method

Gets a content reader to read the contents of a downloaded Google Cloud Storage object. Used by Get-Contents.
public GetContentReader ( string path ) : IContentReader
path string The path to the object to read.
return IContentReader

GetContentReaderDynamicParameters() public method

Required by IContentCmdletProvider, along with GetContentReader(string). Returns null because we have no need for dynamic parameters on Get-Content.
public GetContentReaderDynamicParameters ( string path ) : object
path string
return object

GetContentWriter() public method

Gets a writer used to upload data to a Google Cloud Storage object. Used by Set-Content.
public GetContentWriter ( string path ) : IContentWriter
path string The path of the object to upload to.
return IContentWriter

GetContentWriterDynamicParameters() public method

public GetContentWriterDynamicParameters ( string path ) : object
path string
return object

GetItem() protected method

Writes the object describing the item to the output. Used by Get-Item.
protected GetItem ( string path ) : void
path string The path of the item to get.
return void

HasChildItems() protected method

Checks if a container actually contains items.
protected HasChildItems ( string path ) : bool
path string The path to the container.
return bool

InitializeDefaultDrives() protected method

Creates a default Google Cloud Storage drive named gs.
protected InitializeDefaultDrives ( ) : Collection
return Collection

IsItemContainer() protected method

PowerShell uses this to check if an item is a container. All drives, all buckets, objects that end with "/", and prefixes to objects are containers.
protected IsItemContainer ( string path ) : bool
path string The path of the item to check.
return bool

IsValidPath() protected method

Checks if a path is a legal string of characters. Shoudl pretty much always return null.
protected IsValidPath ( string path ) : bool
path string The path to check.
return bool

ItemExists() protected method

PowerShell uses this to check if items exist.
protected ItemExists ( string path ) : bool
path string
return bool

NewItem() protected method

Creates a new item at the given path.
protected NewItem ( string path, string itemTypeName, object newItemValue ) : void
path string The path of the item ot create.
itemTypeName string The type of item to create. "Directory" is the only special one. /// That will create an object with a name ending in "/".
newItemValue object The value of the item to create. We assume it is a string.
return void

NewItemDynamicParameters() protected method

protected NewItemDynamicParameters ( string path, string itemTypeName, object newItemValue ) : object
path string
itemTypeName string
newItemValue object
return object

RemoveItem() protected method

Deletes a Google Cloud Storage object or bucket. Used by Remove-Item.
protected RemoveItem ( string path, bool recurse ) : void
path string The path to the object or bucket to remove.
recurse bool If true, will remove the desendants of the item as well. Required for a /// non-empty bucket.
return void

RemoveItemDynamicParameters() protected method

protected RemoveItemDynamicParameters ( string path, bool recurse ) : object
path string
recurse bool
return object

Stop() protected method

Dispose the resources used by the provider. Specifically the services.
protected Stop ( ) : void
return void