This page shows you how to enable, disable, and check the status of the Autoclass feature , which is set on a bucket in Cloud Storage.
Required roles
To get the permissions that you need to set and manage Autoclass on a bucket,
ask your administrator to grant you the Storage Admin ( roles/storage.admin 
)
IAM role on the bucket. This predefined role 
contains
the permissions required to set and manage Autoclass on a bucket. To see the
exact permissions that are required, expand the Required permissionssection:
Required permissions
-  storage.buckets.get
-  storage.buckets.list- This permission is only required for using the Google Cloud console to perform the tasks on this page.
 
-  storage.buckets.update
You can also get these permissions with custom roles .
For information about granting roles on buckets, see Set and manage IAM policies on buckets .
Set Autoclass for a bucket
To set Autoclass for a bucket, complete the following instructions:
Console
- In the Google Cloud console, go to the Cloud Storage Buckets 
page.
 
-  In the list of buckets, click the name of the desired bucket. 
-  In the Bucket detailspage, click the Configurationtab. 
-  Click the Editicon ( edit ) for Default storage class. 
-  In the overlay window, select Autoclassto enable Autoclass. To disable Autoclass, select Set a default class, and then select a default storage class for the bucket. 
-  Click Confirm. 
-  To switch the terminal storage class for a bucket that has Autoclass enabled, click the Editicon ( edit ) for Included classes, and click Confirmin the overlay window that appears. 
Command line
Use the  gcloud storage buckets update 
 
command with the
appropriate flags:
gcloud storage buckets update gs:// BUCKET_NAME --default-storage-class= DEFAULT_CLASS AUTOCLASS_FLAG
Where:
-  BUCKET_NAMEis the name of the relevant bucket. For example,my-bucket.
-  DEFAULT_CLASSsets the storage class metadata for the bucket. When enabling Autoclass,STANDARDis the only valid value and is required if the bucket currently uses a different storage class.
-  AUTOCLASS_FLAGis one of the following:-  --enable-autoclassto enable Autoclass.
-  --no-enable-autoclassto disable Autoclass.
-  --autoclass-terminal-storage-class= CLASSto set the terminal storage class for Autoclass. CLASS can be eitherNEARLINEorARCHIVE. When using this flag on a bucket with Autoclass disabled, also include the--enable-autoclassflag in the command.
 
-  
If successful, the response looks similar to the following example:
Updating gs://my-bucket/... Completed 1
Client libraries
C++
For more information, see the Cloud Storage C++ API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
C#
For more information, see the Cloud Storage C# API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Go
For more information, see the Cloud Storage Go API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Java
For more information, see the Cloud Storage Java API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Node.js
For more information, see the Cloud Storage Node.js API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
PHP
For more information, see the Cloud Storage PHP API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Python
For more information, see the Cloud Storage Python API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Ruby
For more information, see the Cloud Storage Ruby API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .

