You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2017/07/17 12:06:15 UTC
[08/18] brooklyn-client git commit: Add a br server command.
Add a br server command.
Displays the URL of the connected Brooklyn.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2bea0368
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2bea0368
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2bea0368
Branch: refs/heads/master
Commit: 2bea03683699745933d2f37c7b41f1b7f69ec21e
Parents: 86acc70
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Wed May 24 15:15:25 2017 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Jul 4 11:06:00 2017 +0100
----------------------------------------------------------------------
cli/command_factory/factory.go | 1 +
cli/commands/server.go | 50 +++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2bea0368/cli/command_factory/factory.go
----------------------------------------------------------------------
diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go
index 4112a53..65ed65e 100644
--- a/cli/command_factory/factory.go
+++ b/cli/command_factory/factory.go
@@ -74,6 +74,7 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor
factory.simpleCommand(commands.NewPolicy(network))
factory.simpleCommand(commands.NewRename(network))
factory.simpleCommand(commands.NewSensor(network))
+ factory.simpleCommand(commands.NewServer(network))
factory.simpleCommand(commands.NewSetConfig(network))
factory.simpleCommand(commands.NewSpec(network))
factory.simpleCommand(commands.NewStartPolicy(network))
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2bea0368/cli/commands/server.go
----------------------------------------------------------------------
diff --git a/cli/commands/server.go b/cli/commands/server.go
new file mode 100644
index 0000000..553ce82
--- /dev/null
+++ b/cli/commands/server.go
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Server 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package commands
+
+import (
+ "github.com/apache/brooklyn-client/cli/command_metadata"
+ "github.com/apache/brooklyn-client/cli/net"
+ "github.com/apache/brooklyn-client/cli/scope"
+ "github.com/urfave/cli"
+ "fmt"
+)
+
+type Server struct {
+ network *net.Network
+}
+
+func NewServer(network *net.Network) (cmd *Server) {
+ cmd = new(Server)
+ cmd.network = network
+ return
+}
+
+func (cmd *Server) Metadata() command_metadata.CommandMetadata {
+ return command_metadata.CommandMetadata{
+ Name: "server",
+ Description: "Display the URL of the connected Brooklyn",
+ Usage: "BROOKLYN_NAME server",
+ Flags: []cli.Flag{},
+ }
+}
+
+func (cmd *Server) Run(scope scope.Scope, c *cli.Context) {
+ fmt.Println(cmd.network.BrooklynUrl)
+}