-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
0ef018a
commit ca9a1bb
Showing
13 changed files
with
244 additions
and
230 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/firehydrant/fhcli/pkg/cli" | ||
) | ||
|
||
func main() { | ||
app := cli.NewApp() | ||
|
||
err := app.Run(os.Args) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 api_client | ||
|
||
import ( | ||
"github.com/go-openapi/runtime" | ||
"github.com/go-openapi/strfmt" | ||
|
||
fhclient "github.com/firehydrant/api-client-go/client" | ||
transport "github.com/go-openapi/runtime/client" | ||
) | ||
|
||
type Config struct { | ||
ApiHost string | ||
ApiKey string | ||
Debug bool | ||
} | ||
|
||
type ApiClient struct { | ||
transport *transport.Runtime | ||
Client *fhclient.FireHydrant | ||
Auth runtime.ClientAuthInfoWriter | ||
} | ||
|
||
func NewApiClient(c Config) ApiClient { | ||
client := ApiClient{} | ||
|
||
client.transport = transport.New(c.ApiHost, "", []string{"http"}) | ||
client.transport.Debug = c.Debug | ||
|
||
client.Client = fhclient.New(client.transport, strfmt.Default) | ||
client.Auth = transport.BearerToken(c.ApiKey) | ||
|
||
return client | ||
} |
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,30 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
changeevents "github.com/firehydrant/fhcli/pkg/change_events" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func eventCmd(c *cli.Context) error { | ||
client := NewApiClient(c) | ||
|
||
ce := changeevents.NewChangeEvent() | ||
|
||
ce.Summary = strings.Join(c.Args(), " ") | ||
ce.Environment = c.String("environment") | ||
ce.Service = c.String("service") | ||
ce.RawIdentities = c.String("identities") | ||
ce.RawLabels = c.String("labels") | ||
|
||
id, err := ce.Submit(client) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(fmt.Sprintf("Created event %s", id)) | ||
|
||
return nil | ||
} |
Oops, something went wrong.