diff --git a/README.md b/README.md index 1725a15..fd5b5c2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ OS Policy is a feature of GCP VM Manager. In order to use OS Policies to deploy > Note: This page is only shown once. Make sure you copy **CLIENT ID**, **SECRET**, and **BASE URL** to a secure location. +## Installation + +[Download release binaries](https://github.com/CrowdStrike/gcp-os-policy/releases/latest) that match your platform + ## Usage 1. Authenticate with the gcloud CLI. @@ -93,7 +97,7 @@ OS Policy is a feature of GCP VM Manager. In order to use OS Policies to deploy 4. Run the tool. ```bash - cs-policy create --bucket example-bucket --zone us-central1-a,us-central1-b --linux-install-params='--tags="Washington/DC_USA,Production" --aph=proxy.example.com --app=8080' --windows-install-params='GROUPING_TAGS="Washington/DC_USA,Production" APP_PROXYNAME=proxy.example.com APP_PROXYPORT=8080' + cs-policy create --bucket=example-bucket --zones=us-central1-a,us-central1-b --linux-install-params='--tags="Washington/DC_USA,Production" --aph=proxy.example.com --app=8080' --windows-install-params='GROUPING_TAGS="Washington/DC_USA,Production" APP_PROXYNAME=proxy.example.com APP_PROXYPORT=8080' ``` Use the `--help` flag to see all available options and more examples. diff --git a/docs/gcptui.gif b/docs/gcptui.gif index e6be9a7..6eae22a 100644 Binary files a/docs/gcptui.gif and b/docs/gcptui.gif differ diff --git a/internal/tui/policy.go b/internal/tui/policy.go index adc7cec..940b326 100644 --- a/internal/tui/policy.go +++ b/internal/tui/policy.go @@ -87,15 +87,15 @@ func (m PolicyModel) View() string { s.WriteString(line) } - if m.completed != len(m.Assignments) && !m.Assignments[0].SkipWait { - prefix := Yellow(fmt.Sprintf(" %s", WarningIcon)) - notice := fmt.Sprintf( - "\n\n%s This may take a while depending on your rollout settings and number of instances. You can use --skip-wait to create the assignments without waiting for the rollout to complete.", - prefix, - ) - s.WriteString(notice) - } - - s.WriteString("\n") + // if m.completed != len(m.Assignments) && !m.Assignments[0].SkipWait { + prefix := Yellow(fmt.Sprintf("%s", WarningIcon)) + notice := fmt.Sprintf( + "\n\n%s This may take a while depending on your rollout settings and number of instances. You can use --skip-wait to create the assignments without waiting for the rollout to complete.", + prefix, + ) + s.WriteString(DefaultStyle.Width(m.width).PaddingLeft(2).Render(notice)) + // } + + s.WriteString("\n\n") return s.String() } diff --git a/internal/tui/storage.go b/internal/tui/storage.go index 8a115b6..cf80306 100644 --- a/internal/tui/storage.go +++ b/internal/tui/storage.go @@ -77,7 +77,6 @@ func (m StorageSyncModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { func (m StorageSyncModel) View() string { s := strings.Builder{} - s.WriteString("\n") prefix := "Ensuring binaries exist in bucket... " s.WriteString(prefix) diff --git a/internal/tui/styles.go b/internal/tui/styles.go index f9e257e..c491f65 100644 --- a/internal/tui/styles.go +++ b/internal/tui/styles.go @@ -6,12 +6,13 @@ import ( ) var ( - Green = ansi.ColorFunc("green") - Red = ansi.ColorFunc("red") - Yellow = ansi.ColorFunc("yellow") - crwdRed = lipgloss.Color("#EC0000") - FailIcon = "X" - SuccessIcon = "✓" - WarningIcon = "!" - ErrorStyle = lipgloss.NewStyle().Foreground(crwdRed) + Green = ansi.ColorFunc("green") + Red = ansi.ColorFunc("red") + Yellow = ansi.ColorFunc("yellow") + crwdRed = lipgloss.Color("#EC0000") + FailIcon = "X" + SuccessIcon = "✓" + WarningIcon = "!" + ErrorStyle = lipgloss.NewStyle().Foreground(crwdRed) + DefaultStyle = lipgloss.NewStyle() ) diff --git a/pkg/cmd/setup/setup.go b/pkg/cmd/create/create.go similarity index 96% rename from pkg/cmd/setup/setup.go rename to pkg/cmd/create/create.go index b640df6..6b0470d 100644 --- a/pkg/cmd/setup/setup.go +++ b/pkg/cmd/create/create.go @@ -1,4 +1,4 @@ -package setup +package create import ( "context" @@ -36,7 +36,7 @@ var skipWait bool var inclusionLabels []string var exclusionLabels []string -// createCmd represents the base cs-policy setup when called without any ubcommands +// createCmd represents the base cs-policy create when called without any ubcommands var createCmd = &cobra.Command{ Use: "create [flags]", Short: "Create GCP OS Policy Assignments for Falcon Sensor deployment", @@ -49,10 +49,10 @@ var createCmd = &cobra.Command{ - Create OS Policy Assignments in the targeted zones`, Example: heredoc.Doc(` Target all VMs in the us-central1-a and us-central-b zones - $ cs-policy setup --zones=us-central1-a,us-central-b --buckt=my-bucket + $ cs-policy create --zones=us-central1-a,us-central-b --buckt=my-bucket Target all VMs in the us-central1-a zone with custom install parameters - $ cs-policy setup --bucket example-bucket --zone us-central1-a --linux-install-params='--tags="Washington/DC_USA,Production" --aph=proxy.example.com --app=8080' --windows-install-params='GROUPING_TAGS="Washington/DC_USA,Production" APP_PROXYNAME=proxy.example.com APP_PROXYPORT=8080' + $ cs-policy create --bucket example-bucket --zone us-central1-a --linux-install-params='--tags="Washington/DC_USA,Production" --aph=proxy.example.com --app=8080' --windows-install-params='GROUPING_TAGS="Washington/DC_USA,Production" APP_PROXYNAME=proxy.example.com APP_PROXYPORT=8080' `), Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { @@ -363,7 +363,7 @@ var createCmd = &cobra.Command{ }, } -func NewSetupCmd() *cobra.Command { +func NewCreateCmd() *cobra.Command { return createCmd } diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 9bdcd93..91a42c3 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -4,7 +4,7 @@ import ( "os" "github.com/MakeNowJust/heredoc" - "github.com/crowdstrike/gcp-os-policy/pkg/cmd/setup" + createCmd "github.com/crowdstrike/gcp-os-policy/pkg/cmd/create" "github.com/spf13/cobra" ) @@ -13,13 +13,13 @@ var rootCmd = &cobra.Command{ Use: "cs-policy [flags]", Short: "cs-policy CLI", Example: heredoc.Doc(` - $ cs-policy setup --help + $ cs-policy create --help `), } // Execute adds all child commands to the root cs-policy setup and sets flags appropriately. func Execute() { - rootCmd.AddCommand(setup.NewSetupCmd()) + rootCmd.AddCommand(createCmd.NewCreateCmd()) err := rootCmd.Execute() if err != nil {