cmd

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 49 Imported by: 14

Documentation

Overview

Package cmd stores the command line interface implementation.

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// BuildTag holds the `git tag` if this is a tagged build/release
	BuildTag = "canary"

	// BuildSHA holds the git commit SHA at `make build` time.
	BuildSHA = "unset"

	// GitTreeState is the state of the git tree, either clean or dirty
	GitTreeState = "unset"
)

Functions

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd returns the root command for AKS Engine.

Types

type LocationsCmd added in v0.48.0

type LocationsCmd struct {
	// contains filtered or unexported fields
}
Example (Run_humanOutput)
d := &LocationsCmd{
	client: &armhelpers.MockAKSEngineClient{},
	authProvider: &mockAuthProvider{
		authArgs:      &authArgs{},
		getClientMock: &armhelpers.MockAKSEngineClient{},
	},
}

r := &cobra.Command{}
f := r.Flags()

addAuthFlags(d.getAuthArgs(), f)

fakeRawSubscriptionID := "6dc93fae-9a76-421f-bbe5-cc6460ea81cb"
fakeSubscriptionID, _ := uuid.Parse(fakeRawSubscriptionID)
fakeClientID := "b829b379-ca1f-4f1d-91a2-0d26b244680d"
fakeClientSecret := "0se43bie-3zs5-303e-aav5-dcf231vb82ds"

d.getAuthArgs().SubscriptionID = fakeSubscriptionID
d.getAuthArgs().rawSubscriptionID = fakeRawSubscriptionID
d.getAuthArgs().rawClientID = fakeClientID
d.getAuthArgs().ClientSecret = fakeClientSecret

args := []string{}

d.output = "human"
if err := d.run(r, args); err != nil {
	fmt.Printf("error running command: %s\n", err)
}
Output:

Location          Name                      Latitude  Longitude
centraluseuap     Central US EUAP (Canary)  N/A       N/A
chinaeast         China East                N/A       N/A
chinaeast2        China East 2              N/A       N/A
chinaeast3        China East 3              N/A       N/A
chinanorth        China North               N/A       N/A
chinanorth2       China North 2             N/A       N/A
chinanorth3       China North 3             N/A       N/A
eastus2euap       East US 2 EUAP (Canary)   N/A       N/A
germanycentral    Germany Central           N/A       N/A
germanynortheast  Germany Northeast         N/A       N/A
israelcentral     Israel Central            N/A       N/A
italynorth        Italy North               N/A       N/A
spaincentral      Spain Central             N/A       N/A
usdodcentral      US DoD Central            N/A       N/A
usdodeast         US Dod East               N/A       N/A
usgovarizona      US Gov Arizona            N/A       N/A
usgoviowa         US Gov Iowa               N/A       N/A
usgovtexas        US Gov Texas              N/A       N/A
usgovvirginia     US Gov Virginia           N/A       N/A
Example (Run_jsonOutput)
d := &LocationsCmd{
	client: &armhelpers.MockAKSEngineClient{},
	authProvider: &mockAuthProvider{
		authArgs:      &authArgs{},
		getClientMock: &armhelpers.MockAKSEngineClient{},
	},
}

r := &cobra.Command{}
f := r.Flags()

addAuthFlags(d.getAuthArgs(), f)

fakeRawSubscriptionID := "6dc93fae-9a76-421f-bbe5-cc6460ea81cb"
fakeSubscriptionID, _ := uuid.Parse(fakeRawSubscriptionID)
fakeClientID := "b829b379-ca1f-4f1d-91a2-0d26b244680d"
fakeClientSecret := "0se43bie-3zs5-303e-aav5-dcf231vb82ds"

d.getAuthArgs().SubscriptionID = fakeSubscriptionID
d.getAuthArgs().rawSubscriptionID = fakeRawSubscriptionID
d.getAuthArgs().rawClientID = fakeClientID
d.getAuthArgs().ClientSecret = fakeClientSecret

args := []string{}

d.output = "json"
if err := d.run(r, args); err != nil {
	fmt.Printf("error running command: %s\n", err)
}
Output:

[
  {
    "id": "N/A",
    "name": "centraluseuap",
    "displayName": "Central US EUAP (Canary)",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinaeast",
    "displayName": "China East",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinaeast2",
    "displayName": "China East 2",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinaeast3",
    "displayName": "China East 3",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinanorth",
    "displayName": "China North",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinanorth2",
    "displayName": "China North 2",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "chinanorth3",
    "displayName": "China North 3",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "eastus2euap",
    "displayName": "East US 2 EUAP (Canary)",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "germanycentral",
    "displayName": "Germany Central",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "germanynortheast",
    "displayName": "Germany Northeast",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "israelcentral",
    "displayName": "Israel Central",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "italynorth",
    "displayName": "Italy North",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "spaincentral",
    "displayName": "Spain Central",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usdodcentral",
    "displayName": "US DoD Central",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usdodeast",
    "displayName": "US Dod East",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usgovarizona",
    "displayName": "US Gov Arizona",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usgoviowa",
    "displayName": "US Gov Iowa",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usgovtexas",
    "displayName": "US Gov Texas",
    "latitude": "N/A",
    "longitude": "N/A"
  },
  {
    "id": "N/A",
    "name": "usgovvirginia",
    "displayName": "US Gov Virginia",
    "latitude": "N/A",
    "longitude": "N/A"
  }
]

type SkusCmd added in v0.49.0

type SkusCmd struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal/mock_internal
Package mock_internal is a generated GoMock package.
Package mock_internal is a generated GoMock package.

Jump to

Keyboard shortcuts

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