-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Moss
committed
Apr 1, 2015
1 parent
f47a6d8
commit 3ccebba
Showing
11 changed files
with
212 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package access_control | ||
|
||
import( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/robertgmoss/brooklyn-cli/models" | ||
"github.com/robertgmoss/brooklyn-cli/net" | ||
) | ||
|
||
func Access(network *net.Network) models.AccessSummary { | ||
url := fmt.Sprintf("/v1/access") | ||
body, err := network.SendGetRequest(url) | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
var access models.AccessSummary | ||
err = json.Unmarshal(body, &access) | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
return access | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/codegangsta/cli" | ||
"github.com/robertgmoss/brooklyn-cli/api/access_control" | ||
"github.com/robertgmoss/brooklyn-cli/command_metadata" | ||
"github.com/robertgmoss/brooklyn-cli/net" | ||
) | ||
|
||
type Access struct { | ||
network *net.Network | ||
} | ||
|
||
func NewAccess(network *net.Network) (cmd *Access) { | ||
cmd = new(Access) | ||
cmd.network = network | ||
return | ||
} | ||
|
||
func (cmd *Access) Metadata() command_metadata.CommandMetadata { | ||
return command_metadata.CommandMetadata{ | ||
Name: "access", | ||
Description: "Show access control", | ||
Usage: "BROOKLYN_NAME access", | ||
Flags: []cli.Flag{}, | ||
} | ||
} | ||
|
||
func (cmd *Access) Run(c *cli.Context) { | ||
access := access_control.Access(cmd.network) | ||
fmt.Println("Location Provisioning Allowed:", access.LocationProvisioningAllowed) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/codegangsta/cli" | ||
"github.com/robertgmoss/brooklyn-cli/api/activities" | ||
"github.com/robertgmoss/brooklyn-cli/command_metadata" | ||
"github.com/robertgmoss/brooklyn-cli/net" | ||
) | ||
|
||
type ActivityStream struct { | ||
network *net.Network | ||
} | ||
|
||
func NewActivityStream(network *net.Network) (cmd *ActivityStream) { | ||
cmd = new(ActivityStream) | ||
cmd.network = network | ||
return | ||
} | ||
|
||
func (cmd *ActivityStream) Metadata() command_metadata.CommandMetadata { | ||
return command_metadata.CommandMetadata{ | ||
Name: "activity-stream", | ||
Description: "Show the stream for a given activity", | ||
Usage: "BROOKLYN_NAME activity-stream ACTIVITY STREAM_ID", | ||
Flags: []cli.Flag{}, | ||
} | ||
} | ||
|
||
func (cmd *ActivityStream) Run(c *cli.Context) { | ||
activityStream := activities.ActivityStream(cmd.network, c.Args()[0], c.Args()[1]) | ||
fmt.Println(activityStream) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/codegangsta/cli" | ||
"github.com/robertgmoss/brooklyn-cli/api/entities" | ||
"github.com/robertgmoss/brooklyn-cli/command_metadata" | ||
"github.com/robertgmoss/brooklyn-cli/net" | ||
) | ||
|
||
type Rename struct { | ||
network *net.Network | ||
} | ||
|
||
func NewRename(network *net.Network) (cmd *Rename) { | ||
cmd = new(Rename) | ||
cmd.network = network | ||
return | ||
} | ||
|
||
func (cmd *Rename) Metadata() command_metadata.CommandMetadata { | ||
return command_metadata.CommandMetadata{ | ||
Name: "rename-entity", | ||
Description: "Rename an entity", | ||
Usage: "BROOKLYN_NAME rename-entity APPLICATION ENTITY", | ||
Flags: []cli.Flag{}, | ||
} | ||
} | ||
|
||
func (cmd *Rename) Run(c *cli.Context) { | ||
rename := entities.Rename(cmd.network, c.Args()[0], c.Args()[1], c.Args()[2]) | ||
fmt.Println(rename) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/codegangsta/cli" | ||
"github.com/robertgmoss/brooklyn-cli/api/entity_config" | ||
"github.com/robertgmoss/brooklyn-cli/command_metadata" | ||
"github.com/robertgmoss/brooklyn-cli/net" | ||
) | ||
|
||
type SetConfig struct { | ||
network *net.Network | ||
} | ||
|
||
func NewSetConfig(network *net.Network) (cmd *SetConfig) { | ||
cmd = new(SetConfig) | ||
cmd.network = network | ||
return | ||
} | ||
|
||
func (cmd *SetConfig) Metadata() command_metadata.CommandMetadata { | ||
return command_metadata.CommandMetadata{ | ||
Name: "set-config", | ||
Description: "Set config for an entity", | ||
Usage: "BROOKLYN_NAME set-config APPLICATION ENTITY CONFIG_KEY VALUE", | ||
Flags: []cli.Flag{}, | ||
} | ||
} | ||
|
||
func (cmd *SetConfig) Run(c *cli.Context) { | ||
response := entity_config.SetConfig(cmd.network, c.Args()[0], c.Args()[1], c.Args()[2], c.Args()[3]) | ||
fmt.Println(response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package models | ||
|
||
type AccessSummary struct { | ||
Links map[string]URI `json:"links"` | ||
LocationProvisioningAllowed bool `json:"locationProvisioningAllowed"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters