pulumi/cmd/login.go
Matt Ellis fe8bad70d1 Don't mention PPC unless needed in the CLI
PPCs are no longer a central concept to our model, but instead a
feature that that pulumi.com provides to some organizations. Let's
remove most mentions of PPCs except for cases where we really need to
talk about them (e.g. when a stack is actually hosted in a PPC instead
of just via the normal pulumi.com service)

Also remove some "in the Pulumi Cloud" messages from the CLI, as using
the Pulumi Cloud is now the only real way to use pulumi.

Fixes pulumi/pulumi-service#1117
2018-04-23 16:50:48 -04:00

44 lines
1 KiB
Go

// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/pulumi/pulumi/pkg/backend"
"github.com/pulumi/pulumi/pkg/backend/cloud"
"github.com/pulumi/pulumi/pkg/backend/local"
"github.com/pulumi/pulumi/pkg/util/cmdutil"
)
func newLoginCmd() *cobra.Command {
var cloudURL string
cmd := &cobra.Command{
Use: "login",
Short: "Log into the Pulumi Cloud",
Long: "Log into the Pulumi Cloud. You can script by using PULUMI_ACCESS_TOKEN environment variable.",
Args: cmdutil.NoArgs,
Run: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {
var b backend.Backend
var err error
if local.IsLocalBackendURL(cloudURL) {
b, err = local.Login(cmdutil.Diag(), cloudURL)
} else {
b, err = cloud.Login(cmdutil.Diag(), cloudURL)
}
if err != nil {
return err
}
fmt.Printf("Logged into %s\n", b.Name())
return nil
}),
}
cmd.PersistentFlags().StringVarP(&cloudURL, "cloud-url", "c", "", "A cloud URL to log into")
return cmd
}