func main() { cli := new(ogcli.OpsGenieClient) cli.SetAPIKey(constants.APIKey) escCli, cliErr := cli.Escalation() if cliErr != nil { panic(cliErr) } req := esc.GetEscalationRequest{Name: ""} response, escErr := escCli.Get(req) if escErr != nil { panic(escErr) } fmt.Printf("Id: %s\n", response.Id) fmt.Printf("Name: %s\n", response.Name) fmt.Printf("Team: %s\n", response.Team) fmt.Printf("Rules:\n") for _, rule := range response.Rules { fmt.Printf("Delay: %d\n", rule.Delay) fmt.Printf("Notify: %s\n", rule.Notify) fmt.Printf("NotifyType: %s\n", rule.NotifyType) fmt.Printf("NotifyCondition: %s\n", rule.NotifyCondition) fmt.Printf("\n") } }
func main() { cli := new(ogcli.OpsGenieClient) cli.SetAPIKey(constants.APIKey) escCli, cliErr := cli.Escalation() if cliErr != nil { panic(cliErr) } req := esc.DeleteEscalationRequest{Name: ""} response, escErr := escCli.Delete(req) if escErr != nil { panic(escErr) } fmt.Printf("status: %s\n", response.Status) fmt.Printf("code: %d\n", response.Code) }
func main() { cli := new(ogcli.OpsGenieClient) cli.SetAPIKey(constants.APIKey) escCli, cliErr := cli.Escalation() if cliErr != nil { panic(cliErr) } rules := []esc.Rule{} rule := esc.Rule{Delay: 4, Notify: "", NotifyCondition: ""} rules = append(rules, rule) req := esc.UpdateEscalationRequest{Id: "", Name: "", Rules: rules} response, escErr := escCli.Update(req) if escErr != nil { panic(escErr) } fmt.Printf("status: %s\n", response.Status) fmt.Printf("code: %d\n", response.Code) }