forked from GoogleCloudPlatform/terraformer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovider_cmd_opsgenie.go
33 lines (29 loc) · 1.03 KB
/
provider_cmd_opsgenie.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cmd
import (
"github.com/spf13/cobra"
opsgenie_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/opsgenie"
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
)
func newCmdOpsgenieImporter(options ImportOptions) *cobra.Command {
var apiKey string
cmd := &cobra.Command{
Use: "opsgenie",
Short: "Import current state to Terraform configuration from Opsgenie",
Long: "Import current state to Terraform configuration from Opsgenie",
RunE: func(cmd *cobra.Command, args []string) error {
provider := newOpsgenieProvider()
err := Import(provider, options, []string{apiKey})
if err != nil {
return err
}
return nil
},
}
cmd.AddCommand(listCmd(newOpsgenieProvider()))
baseProviderFlags(cmd.PersistentFlags(), &options, "user,team", "")
cmd.PersistentFlags().StringVarP(&apiKey, "api-key", "", "", "YOUR_OPSGENIE_API_KEY or env param OPSGENIE_API_KEY")
return cmd
}
func newOpsgenieProvider() terraformutils.ProviderGenerator {
return &opsgenie_terraforming.OpsgenieProvider{}
}