ó ôBQc@s0ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZdd lm Z dd lm Z dd l m Z dd l m Z dd l mZddl mZddl mZddl mZddlmZdZdefd„ƒYZdS(iÿÿÿÿ(tCommand(t COMMAND_NAME(tCOMMAND_NAME_ALIASES(tCONFIG_REQUIRED(t FILE_URIS_OK(tMAX_ARGS(tMIN_ARGS(tPROVIDER_URIS_OK(tSUPPORTED_SUB_ARGS(tURIS_START_ARG(t HELP_NAME(tHELP_NAME_ALIASES(tHELP_ONE_LINE_SUMMARY(t HELP_TEXT(tHelpType(t HELP_TYPE(tNO_MAXs SYNOPSIS gsutil setacl [-R] file-or-canned_acl_name uri... DESCRIPTION The setacl command allows you to set an Access Control List on one or more buckets and objects. The simplest way to use it is to specify one of the canned ACLs, e.g.,: gsutil setacl private gs://bucket or: gsutil setacl public-read gs://bucket/object See "gsutil help acls" for a list of all canned ACLs. If you want to define more fine-grained control over your data, you can retrieve an ACL using the getacl command (see "gsutil help getacl"), save the output to a file, edit the file, and then use the gsutil setacl command to set that ACL on the buckets and/or objects. For example: gsutil getacl gs://bucket/file.txt > acl.txt (Make changes to acl.txt such as adding an additional grant.) gsutil setacl acl.txt gs://cats/file.txt Note that you can set an ACL on multiple buckets or objects at once, for example: gsutil setacl acl.txt gs://bucket/*.jpg If you have a large number of ACLs to update you might want to use the gsutil -m option, to perform a parallel (multi-threaded/multi-processing) update: gsutil -m setacl acl.txt gs://bucket/*.jpg Note that multi-threading/multi-processing is only done when the named URIs refer to objects. gsutil -m setacl gs://bucket1 gs://bucket2 will run the setacl operations sequentially. One other note: If you want to change a set of ACLs by adding and removing grants, without the need to manually retrieve and edit the XML representation, you can do that with the chacl command (see 'gsutil help chacl'). OPTIONS -R, -r Performs setacl request recursively, to all objects under the specified URI. -a Performs setacl request on all object versions. t SetAclCommandcBsˆeZdZi de6ge6de6ee6de6e e 6e e 6de 6e e6Zide6ge6eje6de6ee6Zd„ZRS(s(Implementation of gsutil setacl command.tsetaclitaRrvisSet bucket and/or object ACLscCs–|jrˆx||jD]n\}}|dkr7t|_q|dksO|dkr[t|_q|dkr|jjd|jƒqqWn|jƒdS(Ns-as-rs-Rs-vsOWARNING: The %s -v option is no longer needed, and will eventually be removed. i(tsub_optstTruet all_versionstrecursion_requestedtTHREADED_LOGGERtinfot command_nametSetAclCommandHelper(tselftotunused_a((s3/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/setacl.pyt RunCommand~s       (t__name__t __module__t__doc__RRRRRRtFalseRRR RRt command_specR R Rt COMMAND_HELPRR t_detailed_help_textR t help_specR(((s3/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/setacl.pyRXs$   N(t gslib.commandRRRRRRRRRR tgslib.help_providerR R R R RRt gslib.utilRR&R(((s3/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/setacl.pyts$6