Пример #1
0
  def Run(self, args):
    """See ssh_utils.BaseSSHCLICommand.Run."""
    key = flags.GetKeyFromArgs(args)
    oslogin_client = client.OsloginClient(self.ReleaseTrack())
    user_email = properties.VALUES.core.account.Get()

    expiry = oslogin_utils.ConvertTtlArgToExpiry(args.ttl)

    return oslogin_client.ImportSshPublicKey(user_email, key,
                                             expiration_time=expiry)
Пример #2
0
  def Run(self, args):
    """See ssh_utils.BaseSSHCLICommand.Run."""
    key = flags.GetKeyFromArgs(args)
    oslogin_client = client.OsloginClient(self.ReleaseTrack())
    user_email = properties.VALUES.core.account.Get()

    keys = oslogin_utils.GetKeyDictionaryFromProfile(user_email, oslogin_client)
    fingerprint = oslogin_utils.FindKeyInKeyList(key, keys)

    expiry = oslogin_utils.ConvertTtlArgToExpiry(args.ttl)

    if fingerprint:
      return oslogin_client.UpdateSshPublicKey(user_email, fingerprint,
                                               keys[fingerprint],
                                               'expirationTimeUsec',
                                               expiration_time=expiry)
    else:
      raise client.OsloginKeyNotFoundError('Cannot find requested SSH key.')