cmd

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 34 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()
}
Output:

AWSTemplateFormatVersion: "2010-09-09"

Description: Template generated by cfn-skeleton

Resources:
  MyBucket:
    Type: "AWS::S3::Bucket"
    Properties:
      AccelerateConfiguration:
        AccelerationStatus: CHANGEME
      AccessControl: CHANGEME  # Optional
      AnalyticsConfigurations:
        - Id: CHANGEME
          Prefix: CHANGEME  # Optional
          StorageClassAnalysis:
            DataExport:
              Destination:
                BucketAccountId: CHANGEME
                BucketArn: CHANGEME
                Format: CHANGEME
                Prefix: CHANGEME
              OutputSchemaVersion: CHANGEME
          TagFilters:  # Optional
            - Key: CHANGEME
              Value: CHANGEME
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              KMSMasterKeyID: CHANGEME
              SSEAlgorithm: CHANGEME
      BucketName: CHANGEME  # Optional
      CorsConfiguration:
        CorsRules:
          - AllowedHeaders:
              - CHANGEME
            AllowedMethods:
              - CHANGEME
            AllowedOrigins:
              - CHANGEME
            ExposedHeaders:
              - CHANGEME
            Id: CHANGEME
            MaxAge: 0
      InventoryConfigurations:
        - Destination:
            BucketAccountId: CHANGEME
            BucketArn: CHANGEME
            Format: CHANGEME
            Prefix: CHANGEME
          Enabled: false
          Id: CHANGEME
          IncludedObjectVersions: CHANGEME
          OptionalFields:  # Optional
            - CHANGEME
          Prefix: CHANGEME  # Optional
          ScheduleFrequency: CHANGEME
      LifecycleConfiguration:
        Rules:
          - AbortIncompleteMultipartUpload:
              DaysAfterInitiation: 0
            ExpirationDate: "1970-01-01 00:00:00"
            ExpirationInDays: 0
            Id: CHANGEME
            NoncurrentVersionExpirationInDays: 0
            NoncurrentVersionTransition:
              StorageClass: CHANGEME
              TransitionInDays: 0
            NoncurrentVersionTransitions:
              - StorageClass: CHANGEME
                TransitionInDays: 0
            Prefix: CHANGEME
            Status: CHANGEME
            TagFilters:
              - Key: CHANGEME
                Value: CHANGEME
            Transition:
              StorageClass: CHANGEME
              TransitionDate: "1970-01-01 00:00:00"
              TransitionInDays: 0
            Transitions:
              - StorageClass: CHANGEME
                TransitionDate: "1970-01-01 00:00:00"
                TransitionInDays: 0
      LoggingConfiguration:
        DestinationBucketName: CHANGEME  # Optional
        LogFilePrefix: CHANGEME  # Optional
      MetricsConfigurations:
        - Id: CHANGEME
          Prefix: CHANGEME  # Optional
          TagFilters:  # Optional
            - Key: CHANGEME
              Value: CHANGEME
      NotificationConfiguration:
        LambdaConfigurations:  # Optional
          - Event: CHANGEME
            Filter:
              S3Key:
                Rules:
                  - Name: CHANGEME
                    Value: CHANGEME
            Function: CHANGEME
        QueueConfigurations:  # Optional
          - Event: CHANGEME
            Filter:
              S3Key:
                Rules:
                  - Name: CHANGEME
                    Value: CHANGEME
            Queue: CHANGEME
        TopicConfigurations:  # Optional
          - Event: CHANGEME
            Filter:
              S3Key:
                Rules:
                  - Name: CHANGEME
                    Value: CHANGEME
            Topic: CHANGEME
      ObjectLockConfiguration:
        ObjectLockEnabled: CHANGEME  # Optional
        Rule:  # Optional
          DefaultRetention:
            Days: 0
            Mode: CHANGEME
            Years: 0
      ObjectLockEnabled: false  # Optional
      PublicAccessBlockConfiguration:
        BlockPublicAcls: false  # Optional
        BlockPublicPolicy: false  # Optional
        IgnorePublicAcls: false  # Optional
        RestrictPublicBuckets: false  # Optional
      ReplicationConfiguration:
        Role: CHANGEME
        Rules:
          - Destination:
              AccessControlTranslation:
                Owner: CHANGEME
              Account: CHANGEME
              Bucket: CHANGEME
              EncryptionConfiguration:
                ReplicaKmsKeyID: CHANGEME
              StorageClass: CHANGEME
            Id: CHANGEME
            Prefix: CHANGEME
            SourceSelectionCriteria:
              SseKmsEncryptedObjects:
                Status: CHANGEME
            Status: CHANGEME
      Tags:
        - Key: CHANGEME
          Value: CHANGEME
      VersioningConfiguration:
        Status: CHANGEME
      WebsiteConfiguration:
        ErrorDocument: CHANGEME  # Optional
        IndexDocument: CHANGEME  # Optional
        RedirectAllRequestsTo:  # Optional
          HostName: CHANGEME
          Protocol: CHANGEME
        RoutingRules:  # Optional
          - RedirectRule:
              HostName: CHANGEME
              HttpRedirectCode: CHANGEME
              Protocol: CHANGEME
              ReplaceKeyPrefixWith: CHANGEME
              ReplaceKeyWith: CHANGEME
            RoutingRuleCondition:
              HttpErrorCodeReturnedEquals: CHANGEME
              KeyPrefixEquals: CHANGEME

Outputs:
  MyBucketArn:
    Value: !GetAtt MyBucket.Arn

  MyBucketDomainName:
    Value: !GetAtt MyBucket.DomainName

  MyBucketDualStackDomainName:
    Value: !GetAtt MyBucket.DualStackDomainName

  MyBucketRegionalDomainName:
    Value: !GetAtt MyBucket.RegionalDomainName

  MyBucketWebsiteURL:
    Value: !GetAtt MyBucket.WebsiteURL
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()
}
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()
}
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()
}
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()
}
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()
}
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()
}
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()
}
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()
}
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()
}
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
      --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()
}
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()
}
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()
}
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 Root = &cobra.Command{
	Use:     "rain",
	Long:    "Rain is what happens when you have a lot of CloudFormation ;)",
	Version: version.VERSION,
}

Root represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the Root.

Types

type Command added in v0.8.0

type Command struct {
	cobra.Command
}

Command is a local type that simply wraps cobra.Command

Jump to

Keyboard shortcuts

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