コード例 #1
0
ファイル: version.py プロジェクト: saranraju90/multik8s
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosAuthWrapper()
     response = command_executor(
         command='version',
         show_exec_error=args.show_exec_error,
         env=anthoscli_backend.GetEnvArgsForCommand())
     return self._DefaultOperationResponseHandler(response)
コード例 #2
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     response = command_executor(
         command='desc',
         local_dir=args.LOCAL_DIR,
         env=anthoscli_backend.GetEnvArgsForCommand(),
         show_exec_error=args.show_exec_error)
     return self._DefaultOperationResponseHandler(response)
コード例 #3
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     response = command_executor(
         command='get',
         repo_uri=args.REPO_URI,
         local_dest=args.LOCAL_DIR,
         env=anthoscli_backend.GetEnvArgsForCommand(),
         show_exec_error=args.show_exec_error,
         file_pattern=args.PATTERN)
     return self._DefaultOperationResponseHandler(response)
コード例 #4
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosAuthWrapper()
     response = command_executor(
         command='create-login-config',
         kube_config=args.kubeconfig,
         output_file=args.output,
         merge_from=args.merge_from,
         show_exec_error=args.show_exec_error,
         env=anthoscli_backend.GetEnvArgsForCommand())
     return anthoscli_backend.LoginResponseHandler(response)
コード例 #5
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosAuthWrapper()
     log.status.Print(self._LOGIN_CONFIG_MESSAGE)
     response = command_executor(
         command='login',
         cluster=args.cluster,
         kube_config=args.kubeconfig,
         user=args.user,
         login_config=args.login_config,
         login_config_cert=args.login_config_cert,
         dry_run=args.dry_run,
         show_exec_error=args.show_exec_error,
         env=anthoscli_backend.GetEnvArgsForCommand())
     return self._LoginResponseHandler(response)
コード例 #6
0
 def Run(self, args):
   command_executor = anthoscli_backend.AnthosCliWrapper()
   apply_project = properties.VALUES.core.project.Get()
   auth_cred = anthoscli_backend.GetAuthToken(
       account=properties.VALUES.core.account.Get(), operation='apply')
   log.status.Print('Starting apply of package [{}] using '
                    'project [{}]'.format(args.LOCAL_DIR, apply_project))
   response = command_executor(command='apply',
                               apply_dir=args.LOCAL_DIR,
                               project=apply_project,
                               show_exec_error=args.show_exec_error,
                               env=anthoscli_backend.GetEnvArgsForCommand(
                                   extra_vars={'GCLOUD_AUTH_PLUGIN': 'true'}),
                               stdin=auth_cred)
   return self._DefaultOperationResponseHandler(response)
コード例 #7
0
 def Run(self, args):
   command_executor = anthoscli_backend.AnthosAuthWrapper()
   with progress_tracker.ProgressTracker(
       'Configuring Anthos authentication.', interruptable=True):
     response = command_executor(
         command='login',
         cluster=args.cluster,
         kube_config=args.kubeconfig,
         user=args.user,
         login_config=args.login_config,
         login_config_cert=args.login_config_cert,
         dry_run=args.dry_run,
         show_exec_error=args.show_exec_error,
         env=anthoscli_backend.GetEnvArgsForCommand())
     return self._DefaultOperationResponseHandler(response)
コード例 #8
0
ファイル: apply.py プロジェクト: osakipokima/Social-Lite
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     apply_project = properties.VALUES.core.project.Get()
     auth_cred = anthoscli_backend.GetAuthToken(
         account=properties.VALUES.core.account.Get(), operation='apply')
     log.status.Print('Starting apply of package [{}] using '
                      'project [{}]'.format(args.LOCAL_DIR, apply_project))
     with progress_tracker.ProgressTracker('Apply Running ...',
                                           interruptable=True):
         response = command_executor(
             command='apply',
             apply_dir=args.LOCAL_DIR,
             project=apply_project,
             show_exec_error=args.show_exec_error,
             env=anthoscli_backend.GetEnvArgsForCommand(),
             stdin=auth_cred)
         return self._DefaultOperationResponseHandler(response)
コード例 #9
0
 def Run(self, args):
     is_verbose = args.verbosity == 'debug'
     command_executor = anthoscli_backend.AnthosCliWrapper()
     log.status.Print('Syncing dir [{}]'.format(args.LOCAL_DIR))
     # kpt update requires relative path
     work_dir, at_symbol, git_ref = args.LOCAL_DIR.partition('@')
     pkg_dir = at_symbol.join(['.', git_ref]) if git_ref else '.'
     response = command_executor(
         command='update',
         local_dir=pkg_dir,
         repo_uri=args.REPO_URI,
         strategy=args.strategy,
         dry_run=args.dry_run,
         verbose=is_verbose,
         show_exec_error=args.show_exec_error,
         env=anthoscli_backend.GetEnvArgsForCommand(),
         execution_dir=work_dir)
     return self._DefaultOperationResponseHandler(response)
コード例 #10
0
ファイル: login.py プロジェクト: iofh/QA-System
 def Run(self, args):
   cluster = args.CLUSTER
   config_file = args.login_config
   force_update = args.set_preferred_auth
   anthoscli_backend.GetPreferredAuthForCluster(cluster,
                                                config_file,
                                                force_update)
   command_executor = anthoscli_backend.AnthosAuthWrapper()
   log.status.Print(self._LOGIN_CONFIG_MESSAGE)
   response = command_executor(
       command='login',
       cluster=cluster,
       kube_config=args.kubeconfig,
       user=args.user,
       login_config=config_file,
       login_config_cert=args.login_config_cert,
       dry_run=args.dry_run,
       show_exec_error=args.show_exec_error,
       env=anthoscli_backend.GetEnvArgsForCommand())
   return self._LoginResponseHandler(response)
コード例 #11
0
    def Run(self, args):
        command_executor = anthoscli_backend.AnthosAuthWrapper()

        # Log and execute binary command with flags.
        response = command_executor(
            command="token",
            token_type=args.type,
            cluster=args.cluster,
            aws_sts_region=args.aws_sts_region,
            id_token=args.id_token,
            access_token=args.access_token,
            access_token_expiry=args.access_token_expiry,
            refresh_token=args.refresh_token,
            client_id=args.client_id,
            client_secret=args.client_secret,
            idp_certificate_authority_data=args.idp_certificate_authority_data,
            idp_issuer_url=args.idp_issuer_url,
            kubeconfig_path=args.kubeconfig_path,
            user=args.user,
            env=anthoscli_backend.GetEnvArgsForCommand())
        return self._DefaultOperationResponseHandler(response)
コード例 #12
0
ファイル: export.py プロジェクト: saranraju90/multik8s
    def Run(self, args):
        command_executor = anthoscli_backend.AnthosCliWrapper()
        export_project = args.project or properties.VALUES.core.project.Get()
        cluster = args.CLUSTER or properties.VALUES.compute.zone.Get()
        location = args.location
        output_dir = args.OUTPUT_DIRECTORY
        auth_cred = anthoscli_backend.GetAuthToken(
            account=properties.VALUES.core.account.Get(), operation='export')

        log.status.Print('Starting export of cluster [{}] using '
                         'project [{}]'.format(cluster, export_project))
        response = command_executor(
            command='export',
            cluster=cluster,
            project=export_project,
            location=location,
            output_dir=output_dir,
            show_exec_error=args.show_exec_error,
            env=anthoscli_backend.GetEnvArgsForCommand(
                extra_vars={'GCLOUD_AUTH_PLUGIN': 'true'}),
            stdin=auth_cred)
        return self._DefaultOperationResponseHandler(response)
コード例 #13
0
    def Run(self, args):
        command_executor = anthoscli_backend.AnthosAuthWrapper()
        cluster = args.CLUSTER

        # Get Default Path if flag not provided.
        login_config = args.login_config or command_executor.default_config_path

        # Get contents of config, parsing either URL or File.
        login_config, config_contents, is_url = anthoscli_backend.GetFileOrURL(
            login_config, args.login_config_cert)

        # Get Preferred Auth Method and handle prompting.
        force_update = args.set_preferred_auth
        authmethod, ldapuser, ldappass = anthoscli_backend.GetPreferredAuthForCluster(
            cluster=cluster,
            login_config=login_config,
            config_contents=config_contents,
            force_update=force_update,
            is_url=is_url)

        # Log and execute binary command with flags.
        log.status.Print(messages.LOGIN_CONFIG_MESSAGE)
        response = command_executor(
            command='login',
            cluster=cluster,
            kube_config=args.kubeconfig,
            user=args.user,
            login_config=login_config,
            login_config_cert=args.login_config_cert,
            dry_run=args.dry_run,
            show_exec_error=args.show_exec_error,
            ldap_user=ldapuser,
            ldap_pass=ldappass,
            preferred_auth=authmethod,
            env=anthoscli_backend.GetEnvArgsForCommand(
                extra_vars={'GCLOUD_AUTH_PLUGIN': 'true'}))
        return anthoscli_backend.LoginResponseHandler(
            response, list_clusters_only=(cluster is None))