Qc@s(dZddkZddkZddkZddklZddklZddklZddk Z ddk l Z ddk l Z ddk lZdd k lZdd k lZe iZe iZd e ifd YZd efdYZdefdYZdefdYZdee ifdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefd YZd!efd"YZ d#efd$YZ!d%e!fd&YZ"d'e!fd(YZ#d)Z$dS(*sACommands for interacting with Google Compute Engine VM instances.iN(terrors(tapp(t appcommands(t command_base(tgcutil_logging(tmetadata(tscopes(tssh_keystInstanceCommandc BseZdZdZd,d-d.d/d0d1d2d3d4d5f Zd6d7d8d9d:d;d<d=d>d?f Zhdd6dd6dd6dd6ZdZd Zd!Z d"Z d#Z d$Z d%Z d&Zd'Zd(Zd)Zd*Zd+ZRS(@s7Base command for working with the instances collection.tnames machine-typet machineTypetimagetnetworksnetworkInterfaces.networks network-ipsnetworkInterfaces.networkIPs external-ips%networkInterfaces.accessConfigs.natIPtdiskss disks.sourcetzonetstatussstatus-messaget statusMessaget descriptions creation-timetcreationTimestamptmachinestags-fingerprintstags.fingerprintsmetadata-fingerprintsmetadata.fingerprintt READ_ONLYt read_onlytrot READ_WRITEt read_writetrwt instancestnic0s External NATtONE_TO_ONE_NATt ephemeralcCs6tt|i||tidddd|dS(NRsThe zone for this request.t flag_values(tsuperRt__init__tflagst DEFINE_stringtNone(tselfR R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR ]s  cCsm|i|_|i|_|i|_|i|_|i|_ |i |_ |i |_ dS(sSet the Google Compute Engine API for the command. Args: api: The Google Compute Engine API used by this command. Returns: None. N(tprojectst _projects_apiRt_instances_apitimagest _images_apitkernelst _kernels_apiR t _disks_apit machineTypest_machine_types_apitzonest _zones_api(R$tapi((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pytSetApies c Csx|idgD] }|id+|id|df|id|dfd|jo|id|dfnd |jo|id |d fnd |jo|id |d fnd |jo|id|d fnd|jo|id|dfqqWx|idgD]}|id,|id-|id|i|iddf|id|iddfxw|idgD]c}|id|iddf|id|iddf|id|iddfqWq3Wxe|idgD]Q}|id.|id|iddf|id |id!dfq+W|id"go|id/|id0|id#|id"hid#df|id"hid$g}xJ|D]>}|id%|id&d|i|id'dfqWn|id(go|id1|id2|id#|id(hid#df|id(hid$g} x.| D]"}|id)|i|fqWnd*S(3sCustomized result printing for this type. Args: result: json dictionary returned by the server table: the pretty printing table to be customized Returns: None. R ttdisktindexs typettypetmodes modet deviceNames deviceNametsources sourcetboots boottdeleteOnTerminates delete on terminatetnetworkInterfacessnetwork-interfaces networkR s ipt networkIPt accessConfigss access-configurationR s types external-iptnatIPtserviceAccountssservice-accounttemails scopesRRt fingerprinttitemss %stkeytvaluettagss N(R3R3(R3R3(snetwork-interfaceR3(R3R3(R3R3(smetadataR3(R3R3(stagsR3(tgettAddRowt_PresentElement( R$tresultttableR4R tconfigtservice_accounttmetadata_containertittags_container((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pytCustomizePrintResultwsh          ' #  '   cCst}xr|idgD]^}xU|idgD]A}|id|ijo"d|jo|i|dq5q5WqWt|S(sExtract the external IP(s) from an instance record. Args: instance_record: An instance as returned by the Google Compute Engine API. Returns: A list of internet IP addresses associated with this VM. R<R>R6R?(tsetRGt!ONE_TO_ONE_NAT_ACCESS_CONFIG_TYPEtaddtlist(R$tinstance_recordt external_ipstnetwork_interfacet access_config((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt$_ExtractExternalIpFromInstanceRecords  c Cs|iid|ii}|idh}|idg}tii|}||jotS|i|tii ||yC|ii d|idh|i dd6|d6}|iWn%t i j otidnXtSdS( s"Update the project to include the specified user/key pair. Args: authorized_user_key: A dictionary of a user/key pair for the user. Returns: True iff the ssh key was added to the project. Raises: command_base.CommandError: If the metadata update fails. tprojecttcommonInstanceMetadataRCtbodyRtkindsUnable to add the local ssh key to the project. Either manually remove some entries from the commonInstanceMetadata field of the project, or explicitly set the authorized keys for this instance.N(R&RGt_projecttexecuteRtSshKeyst!GetAuthorizedUserKeysFromMetadatatFalsetappendtSetAuthorizedUserKeysInMetadatatsetCommonInstanceMetadatat_GetResourceApiKindRt HttpErrorRt CommandErrortTrue(R$tauthorized_user_keyR[tcommon_instance_metadatatproject_metadatatproject_ssh_keystrequest((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_AddAuthorizedUserKeyToProjects*           cKsh|id6|i|d6}|ido@|iip|i|i||i_n|ii|d ... RtRUNNINGt TERMINATEDcCstt|i||tidddd|tidddd|tidddd|tid dd d|tid dd d|tid ddd|tidddd|tid|idd|tidgdd|tidt dd|tidddd|ti dgdd|tidddd|ti dgdd i t t iid|tid!t d"d|ti d#gd$d|ti||_dS(%NRR3sInstance descriptionRR sImage name. To get a list of images built by Google, run 'gcutil listimages --project=projects/google'. To get a list of images you have built, run 'gcutil listimages'.tkernelsbKernel name. To get a list of kernels built by Google, run 'gcutil listkernels --project=google'. tpersistent_boot_disksMake boot disk persistent. Copy contents of the image onto a new disk named "boot-{instanceName}" and use it for booting. The preferred kernel for the image will be used to boot, but it may be overridden by passing --kernel.t machine_types[Machine type name. To get a list of available machine types, run 'gcutil listmachinetypes'.R tdefaults,The network to which to attach the instance.tinternal_ip_addresssThe internal (within the specified network) IP address for the instance; if not set the instance will be assigned an appropriate address.texternal_ip_addresssXThe external NAT IP of the new instance. The default value "ephemeral" indicates the service should choose an available ephemeral IP. The value "none" (or an empty string) indicates no external IP will be assigned to the new instance. If an explicit IP is given, that IP must be reserved by the project and not yet assigned to another instance.R4sThe name of a disk to be attached to the instance. The name may be followed by a comma-separated list of name=value pairs specifying options. Legal option names are 'deviceName', to specify the disk's device name, and 'mode', to indicate whether the disk should be attached READ_WRITE (the default) or READ_ONLY. You may also use the 'boot' flag to designate the disk as a boot devicetuse_compute_keysWhether or not to include the default Google Compute Engine ssh key as one of the authorized ssh keys for the created instance. This has the side effect of disabling project-wide ssh key management for the instance.tadd_compute_key_to_projects+Whether or not to add the default Google Compute Engine ssh key as one of the authorized ssh keys for the project. If the default key has already been added to the project, then this will have no effect. The default behavior is to add the key to the project if no instance-specific keys are defined.tauthorized_ssh_keyssFix the list of user/key-file pairs to the specified entries, disabling project-wide key management for this instance. These are specified as a comma separated list of colon separated entries: user1:keyfile1,user2:keyfile2,...RMsQThe service account whose credentials are to be made available for this instance.tservice_account_scopessThe scopes of credentials of the above service account that are to be made available for this instance (comma separated). There are also a set of scope aliases supported: %ss, twait_until_runningsGWhether the program should wait until the instance is in running state.RFsuA set of tags applied to this instance. Used for filtering and to configure network firewall rules (comma separated).(RRR R!R"R#tDEFINE_booleanRtDEFINE_multistringRct DEFINE_listtjointsortedRt SCOPE_ALIASEStkeysRtMetadataFlagsProcessort_metadata_flags_processor(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR hs                 cGs||ptidnt|djo |iiotidntg}|D]}|t|q[~djoti dn|i |ii p|i |ii|i_ |ii p|id|i_ ng}|iiD]}||i|q~}|ii oH|ido8|i| p |iio|id|i_n|ii o*|i|o|id|i_n|ii}|iip |iio|i|}nh}|iio|idptid n|iip|i|id |ii} | id } | d d jp"| d djp| ddjotid| n|ii d| dd| di!} | d|i_ng} xa|D]Y} d| }|id||| , 'value': }] form, ready to be sent to the server. disks: Disks to attach to the instance. Returns: The prepared instance request. RqR^R RR<R RR(R R*Rs machine-typesR R/RtnetworksR R=tnoneR6R?R>RCR@RARRrRFR[R](RgRsRuRR RR_RRRRR RRRRRSRRdtextendRMRRRtExpandScopeAliasesRRRRFRtR'R( R$RwRR tinstance_resourceRXRRYtmetadata_subresourcetexpanded_scopest instance_tagsRy((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRsr                    #    (RRRtpositional_argsRRR RRRRRRRR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR]s  v #     t GetInstancecBseZdZdZdZRS(sGet a machine instance.scCs%|ii|i|}|iS(sGet the specified instance. Args: instance_name: The name of the instance to get. Returns: The result of getting the instance. (R'RGRzR`(R$Rwtinstance_request((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRNs (RRRRR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRIstDeleteInstancecBs#eZdZdZdZdZRS(s}Delete one or more VM instances. If multiple instance names are specified, the instances will be deleted in parallel. s' ... sDelete instancecGs|idoZ|ii oLt|djo|i|i_qj|i|i|d|i_ng}x0|D](}|i|ii|i |qwW|i |\}}|i |d|fS(sDelete the specified instances. Args: *instance_names: Names of the instances to delete. Returns: The result of deleting the instance. RriiR( RtRuRRRRvR'RdtdeleteRzRR(R$RRRwRR((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRgs  (RRRRt safety_promptR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR]st ListInstancescBs,eZdZeZeZdZdZRS(s!List the instances for a project.cCs|idodS|iiS(s+Returns the function for listing instances.RrN(RtR#R'RU(R$((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pytListFuncscCs |iiS(s5Returns the function for listing instances in a zone.(R'RU(R$((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt ListZoneFuncs( RRRRctis_global_level_collectionRjtis_zone_level_collectionR R (((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR s  tAddAccessConfigcBs&eZdZdZdZdZRS(s9Adds an access config to an instance's network interface.scCstt|i||tid|idd|tid|idd|tid|idd|tid|id d|dS( Ntnetwork_interface_namesSThe name of the instance's network interface to which to add the new access config.Rtaccess_config_names"The name of the new access config.taccess_config_typesUThe type of the new access config. Currently only type "ONE_TO_ONE_NAT" is supported.taccess_config_nat_ipsThe external NAT IP of the new access config. The default value "ephemeral" indicates the service should choose an available ephemeral IP. If an explicit IP is given, that IP must be reserved by the project and not yet assigned to another instance.( RRR R!R"RRRSR(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR s"    cCsh|iid6|iid6}|iii|ijo|ii|dDeletes an access config from an instance's network interface.scCsUtt|i||tid|idd|tid|idd|dS(NRsTThe name of the instance's network interface from which to delete the access config.RRs(The name of the access config to delete.(RRR R!R"RR(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR s  cCs=|ii|i|d|iid|ii}|iS(sDeletes an access config from an instance's network interface. Args: instance_name: The instance name from which to delete the access config. Returns: An operation resource. RXRY(R'tdeleteAccessConfigRzRuRRR`(R$Rwtdelete_access_config_request((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs  (RRRRR R(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs tSshInstanceBasecBsSeZdZeZdZdZdZdZdZ dZ dZ RS(s"Base class for SSH-based commands.cCshtt|i||tidddd|tidgdd|tiddd d|dS( Ntssh_portisTCP port to connect toRtssh_args#Additional arguments to pass to sshtssh_key_push_wait_timei,smNumber of seconds to wait for updates to project-wide ssh keys to cascade to the instances within the project(RRR R!tDEFINE_integerR(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR s cCsdS(s&Override the PrintResult to be a noop.N((R$t_((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt PrintResult scCsI|ii|i|}|i}|ptid|n|S(sBGet the instance resource. This is the dictionary returned by the API. Args: instance_name: The name of the instance to retrieve the ssh address for. Returns: The data for the instance resource as returned by the API. Raises: command_base.CommandError: If the instance does not exist. sUnable to find the instance %s.(R'RGRzR`RRi(R$RwRoRJ((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_GetInstanceResources  cCsI|i|}t|djotidn|d|iifS(s?Retrieve the ssh address from the passed instance resource data. Args: instance_resource: The resource data of the instance for which to retrieve the ssh address. Returns: The ssh address and port. Raises: command_base.CommandError: If the instance has no external address. is6Cannot connect to an instance with no external addressi(RZRRRiRuR(R$Rtexternal_addresses((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_GetSshAddress#s   cCs|id}|djotid|n|idh}g}|idgD]'}|iddjo ||q\q\~}|pK|io:|ii}tidtid |ti |qnd S( sEnsure that the user can ssh into the specified instance. This method checks if the instance has SSH keys defined for it, and if it does not this makes sure the enclosing project contains a metadata entry for the user's public ssh key. If the project is updated to add the user's ssh key, then this method waits for the amount of time specified by the wait_time_for_ssh_key_push flag for the change to cascade down to the instance. Args: instance_resource: The resource data for the instance to which to connect. Raises: command_base.CommandError: If the instance is not in the RUNNING state. RRs>Cannot connect to the instance since its current status is %s.RRCRDRsbUpdated project with new ssh key. It can take several minutes for the instance to pick up the key.s0Waiting %s seconds before attempting to connect.N( RGRRiR}RuRRRRR(R$Rtinstance_statusRRRtinstance_ssh_key_entriest wait_time((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_EnsureSshable8s   *    c Cs|i|\}}h|d6|d6|iid6}|ddddddd|iig |ii}titijo|i d nx|D]}|i ||qW|S( sBuilds the given SSH-based command line with the given arguments. A complete SSH-based command line is built from the given command, any common arguments, and the arguments provided. The value of each argument is formatted using a dictionary that contains the following keys: host and port. Args: instance_resource: The resource data of the instance for which to build the ssh command. command: the ssh-based command to run (e.g. ssh or scp) args: arguments for the command Returns: The command line used to perform the requested ssh operation. Raises: IOError: An error occured accessing SSH details. thosttporttusers-osUserKnownHostsFile=/dev/nullsCheckHostIP=nosStrictHostKeyChecking=nos-is-v( R$Rutssh_usertprivate_key_fileRRtleveltloggingtDEBUGRd( R$RtcommandtargsR)R*tvaluest command_linetarg((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt _BuildSshCmd_s   c Cs|i|}|i|||}y|i|Wn)tij o}tid|dSXtiddi|yt i ||Wn%t j o}ti d|nXdS(sRun the given SSH-based command line with the given arguments. The specified SSH-base command is run for the arguments provided. The value of each argument is formatted using a dictionary that contains the following keys: host and port. Args: instance_name: The name of the instance for which to run the ssh command. command: the ssh-based command to run (e.g. ssh or scp) args: arguments for the command Raises: IOError: An error occured accessing SSH details. s&Could not generate compute ssh key: %sNsRunning command line: %sRs-There was a problem executing the command: %s( R"R6R(RRRRRRtostexecvptOSErrorterror(R$RwR1R2RR4R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt _RunSshCmds( RRRRctsort_args_and_flagsR R!R"R$R(R6R;(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs     ' )t SshToInstancecBs&eZdZdZdZdZRS(sSsh to an instance.s cGsSdddddg}g}|D]}||iddq ~}|i||S(sGenerates the command line arguments for the ssh command. Args: *argv: List of additional ssh command line args, if any. Returns: The complete ssh argument list. s-As-ps%(port)ds%(user)s@%(host)ss--t%s%%(treplaceR(R$targvtssh_argsRtat escaped_args((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_GenerateSshArgss - cGs&|i|}|i|d|dS(sSSH into the instance. Args: instance_name: The name of the instance to ssh to. *argv: The remaining unhandled arguments. Returns: The result of the ssh command tsshN(RDR;(R$RwR@RA((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs (RRRRRDR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR=s tPushToInstancecBs&eZdZdZdZdZRS(s&Push one or more files to an instance.s3 ... cGst|djotidnddddg}g}|D]}||iddqC~}|i|d d !|id |d |S( s#Generates the command line arguments for the scp command. Args: *argv: List of files to push and instance-relative destination. Returns: The scp argument list. Raises: command_base.CommandError: If an invalid number of arguments are passed in. is#Invalid number of arguments passed.s-rs-Ps%(port)ds--R>s%%iis%(user)s@%(host)s:(RRRiR?RRd(R$R@tscp_argsRRBRC((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt_GenerateScpArgss -cGs&|i|}|i|d|dS(sDPushes one or more files into the instance. Args: instance_name: The name of the instance to push files to. *argv: The remaining unhandled arguments. Returns: The result of the scp command Raises: command_base.CommandError: If an invalid number of arguments are passed in. tscpN(RHR;(R$RwR@RG((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs(RRRRRHR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRFs tPullFromInstancecBs&eZdZdZdZdZRS(s(Pull one or more files from an instance.s3 ... cGst|djotidnddddg}g}|D]}||iddqC~}x&|d d !D]}|id |qsW|i|d |S( s Generates the command line arguments for the scp command. Args: *argv: List of files to pull and local-relative destination. Returns: The scp argument list. Raises: command_base.CommandError: If an invalid number of arguments are passed in. is#Invalid number of arguments passed.s-rs-Ps%(port)ds--R>s%%iis%(user)s@%(host)s:(RRRiR?Rd(R$R@RGRRBRCR5((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRHs -cGs&|i|}|i|d|dS(sGPulls one or more files from the instance. Args: instance_name: The name of the instance to pull files from. *argv: The remaining unhandled arguments. Returns: The result of the scp command Raises: command_base.CommandError: If an invalid number of arguments are passed in. RIN(RHR;(R$RwR@RG((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRs(RRRRRHR(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRJs tGetSerialPortOutputcBs&eZdZdZdZdZRS(s,Get the output of an instance's serial port.scCsI|ido&|ii|i|}|iStiddS(sGet the specified instance's serial port output. Args: instance_name: The name of the instance. Returns: The output of the instance's serial port. tv1beta13s;Serial port output is only supported in v1beta13 and above.N(RtR'tgetSerialPortOutputRzR`RR(R$RwR((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR-s   cCs4|iiott|i|n |dGHdS(s&Override the PrintResult to be a noop.tcontentsN(Rut print_jsonRRKR!(R$RJ((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR!?s (RRRRRR!(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRK(s t#OptimisticallyLockedInstanceCommandcBs eZdZdZdZRS(s<Base class for instance commands that require a fingerprint.cCs6tt|i||tidddd|dS(NRBsFingerprint of the data to be overwritten. This fingerprint provides optimistic locking--data will only be set if the given fingerprint matches the state of the data prior to this request.R(RRPR R!R"R#(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR Ms  cOs0|iiptidn|i||S(s1Invokes the HandleCommand method of the subclass.s1You must provide a fingerprint with your request.(RuRBRRt HandleCommand(R$R2Ry((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRXs (RRRR R(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRPJs t SetMetadatacBs&eZdZdZdZdZRS(s4Sets instance metadata and sends new metadata to instances. This method overwrites existing instance metadata with new metadata. Common metadata (project-wide) is preserved. For example, running: gcutil --project= setinstancemetadata my-instance --metadata="key1:value1" --fingerprint= ... gcutil --project= setinstancemetadata my-instance --metadata="key2:value2" --fingerprint= will result in 'my-instance' having 'key2:value2' as its metadata. scCsNtt|i||tidddd|ddti||_dS(NtforcesESet new metadata even if the key "sshKeys" will no longer be present.Rt short_nametf( RRRR R!t DEFINE_boolR#RRR(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR ts c Cs|ii}|iipRtg}|D]}||dq*~}|iid|i}|i}|idh}|idg}tg} |D]}| |dq~ } |i i|i |} | i} | idh} | idg} tg}| D]}||dq~}d|jo-d|jo d| jot i dqnnh|i dd6|d6|iid 6}|i i|i |d |}|iS( sSet instance-specific metadata. Args: instance_name: The name of the instance scoping this request. Returns: An operation resource. RDR[R\RCRRshDiscarding update that would have erased instance sshKeys. Re-run with the -f flag to force the update.R^RBR](RRRuRSRRR&RGR_R`R'RzRRiRgRBt setMetadata(R$Rwt new_metadataRRtnew_keyst get_projecttproject_resourceRmRt project_keyst get_instanceRRRt instance_keystmetadata_resourcetset_metadata_request((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRQs0  + +  +  (RRRRR RQ(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRR_s tSetTagscBs eZdZdZdZRS(sSets instance tags and sends new tags to the instance. This method overwrites existing instance tags. For example, running: gcutil --project= setinstancetags my-instance --tags="tag-1" --fingerprint= ... gcutil --project= setinstancetags my-instance --tags="tag-2,tag-3" --fingerprint= will result in 'my-instance' having tags 'tag-2' and 'tag-3'. cCs6tt|i||tidgdd|dS(NRFsuA set of tags applied to this instance. Used for filtering and to configure network firewall rules (comma separated).R(RRaR R!R(R$R R((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyR s  cCsWhtt|iid6|iid6}|ii|i|d|}|iS(sSet instance tags. Args: instance_name: The name of the instance scoping this request. Returns: An operation resource. RCRBR]( RRRRuRFRBR'tsetTagsRzR`(R$Rwt tag_resourcetset_tags_request((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRQs  (RRRR RQ(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyRas cCstidttidttidttidttidttidttidttidt tid t tid t tid t tid t d S(s)Add all of the instance related commands.t addinstancet getinstancetdeleteinstancet listinstancestaddaccessconfigtdeleteaccessconfigREtpushtpulltgetserialportoutputtsetinstancemetadatatsetinstancetagsN(RtAddCmdRRRR RRR=RFRJRKRRRa(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyt AddCommandss(%RR/R7Rt apiclientRtgoogle.apputilsRRtgflagsR!tgcutilRRRRRtFLAGSRtGoogleComputeCommandRRRRtGoogleComputeListCommandR RRRR=RFRJRKRPRRRaRq(((sb/Users/riccardo/git/gcloud/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyts@      4";$#/0"I,