Skip to content

Commit

Permalink
update readme (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffalor authored Apr 23, 2024
1 parent f41581e commit dbc38f8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 28 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
Binary file modified docs/gcptui.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions internal/tui/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
1 change: 0 additions & 1 deletion internal/tui/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions internal/tui/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
10 changes: 5 additions & 5 deletions pkg/cmd/setup/setup.go → pkg/cmd/create/create.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package setup
package create

import (
"context"
Expand Down Expand Up @@ -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",
Expand All @@ -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) {
Expand Down Expand Up @@ -363,7 +363,7 @@ var createCmd = &cobra.Command{
},
}

func NewSetupCmd() *cobra.Command {
func NewCreateCmd() *cobra.Command {
return createCmd
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -13,13 +13,13 @@ var rootCmd = &cobra.Command{
Use: "cs-policy <command> [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 {
Expand Down

0 comments on commit dbc38f8

Please sign in to comment.