cmd

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Example (Build_bucket)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"build",
		"AWS::S3::Bucket",
	}

	cmd.Execute(cmd.Rain)
	
Example (Cat_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"cat",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Downloads the template used to deploy <stack> and prints it to stdout.

Usage:
  rain cat <stack>

Flags:
  -h, --help          help for cat
  -t, --transformed   Get the template with transformations applied by CloudFormation.
  -u, --unformatted   Output the template in its raw form and do not attempt to format it.

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Check_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"check",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Reads the specified CloudFormation template and validates it against the current CloudFormation specification.

Usage:
  rain check <template file>

Flags:
  -h, --help   help for check

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Deploy_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"deploy",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Creates or updates a CloudFormation stack named <stack> from the template file <template>.
If you don't specify a stack name, rain will use the template filename minus its extension.

Usage:
  rain deploy <template> [stack]

Flags:
  -d, --detach           Once deployment has started, don't wait around for it to finish.
  -f, --force            Don't ask questions; just deploy.
  -h, --help             help for deploy
      --params strings   Set parameter values. Use the format key1=value1,key2=value2.
      --tags strings     Add tags to the stack. Use the format key1=value1,key2=value2.

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Diff)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"diff",
		"../examples/success.template",
		"../examples/failure.template",
	}

	cmd.Execute(cmd.Rain)
}
Output:

(>) Description: This template fails
(-) Parameters: {...}
(|) Resources:
(|)   Bucket1:
(-)     Properties: {...}
(+)   Bucket2:
(+)     Properties:
(+)       BucketName: !Ref Bucket1
(+)     Type: "AWS::S3::Bucket"
Example (Fmt_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"fmt",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Reads the named template and outputs a nicely formatted copy.

Usage:
  rain fmt <filename>

Aliases:
  fmt, format

Flags:
  -c, --compact   Produce more compact output.
  -h, --help      help for fmt
  -j, --json      Output the template as JSON (default format: YAML).
  -v, --verify    Check if the input is already correctly formatted and exit.
                  The exit status will be 0 if so and 1 if not.
  -w, --write     Write the output back to the file rather than to stdout.

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Info_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"info",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Display the AWS account and region that you're configured to use.

Usage:
  rain info

Flags:
  -c, --creds   Include current AWS credentials
  -h, --help    help for info

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Logs_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"logs",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Shows a nicely-formatted list of the event log for the named stack, optionally limiting the results to a single resource.

By default, rain will only show log entries that contain a message, for example a failure reason. You can use flags to change this behaviour.

Usage:
  rain logs <stack> (<resource>)

Aliases:
  logs, log

Flags:
  -a, --all    Include uninteresting logs
  -h, --help   help for logs
  -l, --long   Display full details
  -t, --time   Show results in order of time instead of grouped by resource

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Ls_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"ls",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Displays a list of all running stacks or the contents of <stack> if provided.

Usage:
  rain ls <stack>

Aliases:
  ls, list

Flags:
  -a, --all      List stacks across all regions
  -h, --help     help for ls
  -n, --nested   Show nested stacks (hidden by default)

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Rainhelp)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
	}

	cmd.Execute(cmd.Rain)
}
Output:

Rain is what happens when you have a lot of CloudFormation ;)

Usage:
  rain [command]

Stack commands:
  cat         Get the CloudFormation template from a running stack
  deploy      Deploy a CloudFormation stack from a local template
  logs        Show the event log for the named stack
  ls          List running CloudFormation stacks
  rm          Delete a running CloudFormation stack
  watch       Display an updating view of a CloudFormation stack

Template commands:
  build       Create CloudFormation templates
  check       Validate a CloudFormation template against the spec
  diff        Compare CloudFormation templates
  fmt         Format CloudFormation templates
  tree        Find dependencies of Resources and Outputs in a local template

Other Commands:
  help        Help about any command
  info        Show your current configuration

Flags:
      --debug            Output debugging information
  -h, --help             help for rain
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
  -v, --version          version for rain

Use "rain [command] --help" for more information about a command.
Example (Rm_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"rm",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Deletes the CloudFormation stack named <stack> and waits for the action to complete.

Usage:
  rain rm <stack>

Aliases:
  rm, remove, del, delete

Flags:
  -d, --detach   Once removal has started, don't wait around for it to finish.
  -f, --force    Do not ask; just delete
  -h, --help     help for rm

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use
Example (Tree)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"tree",
		"../examples/success.template",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Resources:
  Bucket1:
    DependsOn:
      Parameters:
        - BucketName
Example (Watch_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/cmd"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"help",
		"watch",
	}

	cmd.Execute(cmd.Rain)
}
Output:

Repeatedly displays the status of a CloudFormation stack. Useful for watching the progress of a deployment started from outside of Rain.

Usage:
  rain watch <stack>

Flags:
  -h, --help   help for watch
  -w, --wait   Wait for changes to begin rather than refusing to watch an unchanging stack

Global Flags:
      --debug            Output debugging information
  -p, --profile string   AWS profile name; read from the AWS CLI configuration file
  -r, --region string    AWS region to use

Index

Examples

Constants

This section is empty.

Variables

View Source
var Build = buildCmd

Build is exposed to be available to the cfn-skeleton command

View Source
var Fmt = fmtCmd

Fmt is exposed to be available to the cfn-format command

View Source
var Rain = &cobra.Command{
	Use:     "rain",
	Long:    "Rain is what happens when you have a lot of CloudFormation ;)",
	Version: version.VERSION,
}

Rain represents the base command when called without any subcommands

Functions

func Execute

func Execute(cmd *cobra.Command)

Execute wraps a command with error trapping that deals with the debug flag

func Wrap added in v0.9.0

func Wrap(name string, src *cobra.Command) *cobra.Command

Wrap creates a new command with the same functionality as src but with a new name and default options added for executables e.g. the --debug flag

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL