• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang client.OpsGenieClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/opsgenie/opsgenie-go-sdk/client.OpsGenieClient的典型用法代码示例。如果您正苦于以下问题:Golang OpsGenieClient类的具体用法?Golang OpsGenieClient怎么用?Golang OpsGenieClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了OpsGenieClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the alert
	req := alerts.CreateAlertRequest{Message: samples.RandStringWithPrefix("Test", 8)}
	response, alertErr := alertCli.Create(req)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("message: %s\n", response.Message)
	fmt.Printf("alert id: %s\n", response.AlertID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// add team to the alert
	addTeamReq := alerts.AddTeamAlertRequest{ID: response.AlertID, Team: constants.TeamName}
	addTeamResponse, alertErr := alertCli.AddTeam(addTeamReq)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("status: %s\n", addTeamResponse.Status)
	fmt.Printf("code: %d\n", addTeamResponse.Code)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:34,代码来源:alert_create_addteam.go


示例2: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// list the alerts
	listreq := alerts.ListAlertsRequest{}
	listresp, listErr := alertCli.List(listreq)

	if listErr != nil {
		panic(listErr)
	}

	for _, alert := range listresp.Alerts {
		fmt.Printf("Id: %s\n", alert.ID)
		fmt.Printf("Alias: %s\n", alert.Alias)
		fmt.Printf("Message: %s\n", alert.Message)
		fmt.Printf("Status: %s\n", alert.Status)
		fmt.Printf("IsSeen?: %t\n", alert.IsSeen)
		fmt.Printf("Acknowledged?: %t\n", alert.Acknowledged)
		fmt.Printf("Created at: %d\n", alert.CreatedAt)
		fmt.Printf("Updated at: %d\n", alert.UpdatedAt)
		fmt.Printf("Tiny id: %s\n", alert.TinyID)
		fmt.Printf("Owner: %s\n", alert.Owner)
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:31,代码来源:alert_listalerts.go


示例3: main

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")
	}

}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:30,代码来源:escalation_get.go


示例4: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	teamCli, cliErr := cli.Team()

	if cliErr != nil {
		panic(cliErr)
	}

	req := team.ListTeamLogsRequest{Name: ""}
	response, teamErr := teamCli.ListLogs(req)

	if teamErr != nil {
		panic(teamErr)
	}

	fmt.Printf("Last Key: %s\n", response.LastKey)
	for _, log := range response.Logs {
		fmt.Printf("Log: %s\n", log.Log)
		fmt.Printf("Owner: %s\n", log.Owner)
		fmt.Printf("CreatedAt: %d\n", log.CreatedAt)
		fmt.Printf("\n")
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:25,代码来源:team_list_team_logs.go


示例5: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	teamCli, cliErr := cli.Team()

	if cliErr != nil {
		panic(cliErr)
	}

	req := team.GetTeamRequest{Name: ""}
	response, teamErr := teamCli.Get(req)

	if teamErr != nil {
		panic(teamErr)
	}

	fmt.Printf("Id: %s\n", response.Id)
	fmt.Printf("Name: %s\n", response.Name)
	fmt.Printf("Members:\n")

	for _, member := range response.Members {
		fmt.Printf("User: %s\n", member.User)
		fmt.Printf("Role: %s\n", member.Role)
		fmt.Printf("\n")
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:27,代码来源:team_get.go


示例6: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the alert
	req := alerts.CreateAlertRequest{Message: samples.RandStringWithPrefix("Test", 8), Note: "Created for testing purposes"}
	response, alertErr := alertCli.Create(req)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("message: %s\n", response.Message)
	fmt.Printf("alert id: %s\n", response.AlertID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// list alert recipients
	getRecipientsReq := alerts.ListAlertRecipientsRequest{ID: response.AlertID}
	getRecipientsResponse, alertErr := alertCli.ListRecipients(getRecipientsReq)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("Users:  %v\n", getRecipientsResponse.Users)
	fmt.Printf("Groups:  %v\n", getRecipientsResponse.Groups)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:34,代码来源:alert_create_listrecipients.go


示例7: Notify

func (opsgenie *OpsGenieNotifier) Notify(messages Messages) bool {

	overallStatus, pass, warn, fail := messages.Summary()

	client := new(ogcli.OpsGenieClient)
	client.SetApiKey(opsgenie.ApiKey)

	alertCli, cliErr := client.Alert()

	if cliErr != nil {
		log.Println("Opsgenie notification trouble with client")
		return false
	}

	for _, message := range messages {
		title := fmt.Sprintf("\n%s:%s:%s is %s.", message.Node, message.Service, message.Check, message.Status)
		content := fmt.Sprintf(header, opsgenie.ClusterName, overallStatus, fail, warn, pass)
		content += fmt.Sprintf("\n%s:%s:%s is %s.", message.Node, message.Service, message.Check, message.Status)
		content += fmt.Sprintf("\n%s", message.Output)

		// create the alert
		response, alertErr := opsgenie.Send(alertCli, title, content)

		if alertErr != nil {
			log.Println("Opsgenie notification trouble.", response.Status)
			return false
		}

	}

	log.Println("Opsgenie notification send.")
	return true
}
开发者ID:ryane,项目名称:consul-alerts,代码行数:33,代码来源:opsgenie-notifier.go


示例8: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	integrationCli, cliErr := cli.Integration()

	if cliErr != nil {
		panic(cliErr)
	}
	//disable integration
	disableReq := itg.DisableIntegrationRequest{Name: constants.IntegrationName}
	_, itgError := integrationCli.Disable(disableReq)

	if itgError != nil {
		panic(itgError)
	}
	fmt.Printf("Integration disabled successfuly\n")

	//enable integration
	enableReq := itg.EnableIntegrationRequest{Name: constants.IntegrationName}
	_, itgError = integrationCli.Enable(enableReq)

	if itgError != nil {
		panic(itgError)
	}
	fmt.Printf("Integration enabled successfuly\n")
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:27,代码来源:enable_disable_integration.go


示例9: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the alert
	req := alerts.CreateAlertRequest{Message: samples.RandStringWithPrefix("Test", 8)}
	response, alertErr := alertCli.Create(req)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("message: %s\n", response.Message)
	fmt.Printf("alert id: %s\n", response.AlertID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// delete the alert
	delreq := alerts.DeleteAlertRequest{ID: response.AlertID, Source: constants.Source}
	cloresponse, alertErr := alertCli.Delete(delreq)
	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("status: %s\n", cloresponse.Status)
	fmt.Printf("code: %d\n", cloresponse.Code)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:33,代码来源:alert_create_delete.go


示例10: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	userCli, cliErr := cli.User()

	if cliErr != nil {
		panic(cliErr)
	}

	req := user.GetUserRequest{Username: ""}
	response, userErr := userCli.Get(req)

	if userErr != nil {
		panic(userErr)
	}

	fmt.Printf("Id: %s\n", response.Id)
	fmt.Printf("Username: %s\n", response.Username)
	fmt.Printf("Fullname: %s\n", response.Fullname)
	fmt.Printf("Timezone: %s\n", response.Timezone)
	fmt.Printf("Locale: %s\n", response.Locale)
	fmt.Printf("State: %s\n", response.State)
	fmt.Printf("Escalations: %v\n", response.Escalations)
	fmt.Printf("Schedules: %v\n", response.Schedules)
	fmt.Printf("Role: %v\n", response.Role)
	fmt.Printf("Groups: %v\n", response.Groups)
	fmt.Printf("Contacts: %v\n", response.Contacts)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:29,代码来源:user_get.go


示例11: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	schCli, cliErr := cli.Schedule()

	if cliErr != nil {
		panic(cliErr)
	}

	restrictions := []sch.Restriction{}
	restriction := sch.Restriction{StartDay: "", StartTime: "", EndDay: "", EndTime: ""}
	restrictions = append(restrictions, restriction)

	rotations := []sch.Rotation{}
	rotation := sch.Rotation{Name: "", StartDate: "", EndDate: "", Participants: []string{""}, RotationType: ""}
	rotations = append(rotations, rotation)

	enabled := true

	req := sch.UpdateScheduleRequest{Id: "", Name: "", Timezone: "", Enabled: &enabled, Rotations: rotations}
	response, userErr := schCli.Update(req)

	if userErr != nil {
		panic(userErr)
	}

	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:30,代码来源:schedule_update.go


示例12: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	userCli, cliErr := cli.User()

	if cliErr != nil {
		panic(cliErr)
	}

	req := user.ListUsersRequest{}
	response, userErr := userCli.List(req)

	if userErr != nil {
		panic(userErr)
	}

	for _, user := range response.Users {
		fmt.Printf("Id: %s\n", user.Id)
		fmt.Printf("Username: %s\n", user.Username)
		fmt.Printf("Fullname: %s\n", user.Fullname)
		fmt.Printf("Timezone: %s\n", user.Timezone)
		fmt.Printf("Locale: %s\n", user.Locale)
		fmt.Printf("State: %s\n", user.State)
		fmt.Printf("Escalations: %v\n", user.Escalations)
		fmt.Printf("Schedules: %v\n", user.Schedules)
		fmt.Printf("Role: %v\n", user.Role)
		fmt.Printf("Groups: %v\n", user.Groups)
		fmt.Printf("Contacts: %v\n", user.Contacts)
		fmt.Printf("\n")
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:32,代码来源:user_list.go


示例13: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	policyCli, cliErr := cli.Policy()

	if cliErr != nil {
		panic(cliErr)
	}
	//disable policy
	disableReq := policy.DisablePolicyRequest{Name: constants.PolicyName}
	_, itgError := policyCli.Disable(disableReq)

	if itgError != nil {
		panic(itgError)
	}
	fmt.Printf("Policy disabled successfuly\n")

	//enable policy
	enableReq := policy.EnablePolicyRequest{Name: constants.PolicyName}
	_, itgError = policyCli.Enable(enableReq)

	if itgError != nil {
		panic(itgError)
	}
	fmt.Printf("Policy enabled successfuly\n")
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:27,代码来源:enable_disable_policy.go


示例14: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	teamCli, cliErr := cli.Team()

	if cliErr != nil {
		panic(cliErr)
	}

	members := []team.Member{}
	member := team.Member{User: "", Role: ""}
	members = append(members, member)

	req := team.CreateTeamRequest{Name: "", Members: members}
	response, teamErr := teamCli.Create(req)

	if teamErr != nil {
		panic(teamErr)
	}

	fmt.Printf("id: %s\n", response.Id)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:25,代码来源:team_create.go


示例15: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the alert
	req := alerts.CreateAlertRequest{Message: samples.RandStringWithPrefix("Test", 8)}
	response, alertErr := alertCli.Create(req)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("message: %s\n", response.Message)
	fmt.Printf("alert id: %s\n", response.AlertID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	addnotereq := alerts.AddNoteAlertRequest{}
	// add alert ten notes
	for i := 0; i < 10; i++ {
		addnotereq.ID = response.AlertID
		addnotereq.Note = samples.RandString(45)
		addnoteresp, alertErr := alertCli.AddNote(addnotereq)
		if alertErr != nil {
			panic(alertErr)
		}
		fmt.Printf("[Add note] %s %d\n", addnoteresp.Status, addnoteresp.Code)
	}
	listNotesReq := alerts.ListAlertNotesRequest{IF: response.AlertID}
	listNotesResponse, alertErr := alertCli.ListNotes(listNotesReq)
	if alertErr != nil {
		panic(alertErr)
	}

	alertNotes := listNotesResponse.Notes

	fmt.Printf("Last key: %s\n", listNotesResponse.LastKey)
	fmt.Printf("Notes:\n")
	fmt.Printf("------\n")

	for _, note := range alertNotes {
		fmt.Printf("Note: %s\n", note.Note)
		fmt.Printf("Owner: %s\n", note.Owner)
		fmt.Printf("Created at: %d\n", note.CreatedAt)
		fmt.Printf("-------------------------\n")
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:53,代码来源:alert_create_addnote_listnotes.go


示例16: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	alertCli, cliErr := cli.Alert()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the alert
	req := alerts.CreateAlertRequest{Message: samples.RandStringWithPrefix("Test", 8), Note: "Created for testing purposes", User: constants.User}
	response, alertErr := alertCli.Create(req)

	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("message: %s\n", response.Message)
	fmt.Printf("alert id: %s\n", response.AlertID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// close the alert
	getreq := alerts.GetAlertRequest{ID: response.AlertID}
	getresponse, alertErr := alertCli.Get(getreq)
	if alertErr != nil {
		panic(alertErr)
	}

	fmt.Printf("tags: %v\n", getresponse.Tags)
	fmt.Printf("count: %d\n", getresponse.Count)
	fmt.Printf("teams: %v\n", getresponse.Teams)
	fmt.Printf("recipients: %v\n", getresponse.Recipients)
	fmt.Printf("tiny id: %s\n", getresponse.TinyID)
	fmt.Printf("alias: %s\n", getresponse.Alias)
	fmt.Printf("entity: %s\n", getresponse.Entity)
	fmt.Printf("id: %s\n", getresponse.ID)
	fmt.Printf("updated at: %d\n", getresponse.UpdatedAt)
	fmt.Printf("message: %s\n", getresponse.Message)
	fmt.Printf("details: %v\n", getresponse.Details)
	fmt.Printf("source: %s\n", getresponse.Source)
	fmt.Printf("description: %s\n", getresponse.Description)
	fmt.Printf("created at: %d\n", getresponse.CreatedAt)
	fmt.Printf("is seen?: %t\n", getresponse.IsSeen)
	fmt.Printf("acknowledged?: %t\n", getresponse.Acknowledged)
	fmt.Printf("owner: %s\n", getresponse.Owner)
	fmt.Printf("actions: %s\n", getresponse.Actions)
	fmt.Printf("system data: %v\n", getresponse.SystemData)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:50,代码来源:alert_create_get.go


示例17: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	hbCli, cliErr := cli.Heartbeat()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the hb
	req := hb.AddHeartbeatRequest{Name: samples.RandStringWithPrefix("Test", 4)}
	response, hbErr := hbCli.Add(req)

	if hbErr != nil {
		panic(hbErr)
	}

	fmt.Printf("Heartbeat added\n")
	fmt.Printf("---------------\n")
	fmt.Printf("name: %s\n", response.Name)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// update the newly created heart beat, change description
	updateReq := hb.UpdateHeartbeatRequest{Name: response.Name, Description: "new description"}
	updateResp, updateErr := hbCli.Update(updateReq)

	if updateErr != nil {
		panic(updateErr)
	}

	fmt.Printf("Heartbeat updated\n")
	fmt.Printf("-----------------\n")
	fmt.Printf("name: %s\n", updateResp.Name)
	fmt.Printf("status: %s\n", updateResp.Status)
	fmt.Printf("code: %d\n", updateResp.Code)

	getReq := hb.GetHeartbeatRequest{Name: response.Name}
	getResp, getErr := hbCli.Get(getReq)
	if getErr != nil {
		panic(getErr)
	}

	fmt.Printf("Heartbeat details\n")
	fmt.Printf("-----------------\n")
	fmt.Printf("Name: %s\n", getResp.Name)
	fmt.Printf("Description: %s\n", getResp.Description)
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:49,代码来源:heartbeat_create_and_update.go


示例18: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	hbCli, cliErr := cli.Heartbeat()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the hb
	req := hb.AddHeartbeatRequest{Name: samples.RandStringWithPrefix("Test", 4)}
	response, hbErr := hbCli.Add(req)

	if hbErr != nil {
		panic(hbErr)
	}

	fmt.Printf("Heartbeat created\n")
	fmt.Printf("-----------------\n")
	fmt.Printf("id: %s\n", response.ID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// list the HBs
	listReq := hb.ListHeartbeatsRequest{}
	listResp, listErr := hbCli.List(listReq)
	if listErr != nil {
		panic(listErr)
	}

	fmt.Printf("Heartbeats\n")
	fmt.Printf("-----------------\n")
	beats := listResp.Heartbeats
	for _, beat := range beats {
		fmt.Printf("Id: %s\n", beat.ID)
		fmt.Printf("Name: %s\n", beat.Name)
		fmt.Printf("Status %s\n", beat.Status)
		fmt.Printf("Description: %s\n", beat.Description)
		fmt.Printf("Enabled?: %t\n", beat.Enabled)
		fmt.Printf("Last Heartbeat: %d\n", beat.LastHeartbeat)
		fmt.Printf("Interval: %d\n", beat.Interval)
		fmt.Printf("Interval Unit: %s\n", beat.IntervalUnit)
		fmt.Printf("Expired?: %t\n", beat.Expired)
		fmt.Printf("-----------------\n")
	}
}
开发者ID:victortrac,项目名称:opsgenie-go-sdk,代码行数:47,代码来源:heartbeat_list.go


示例19: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	hbCli, cliErr := cli.Heartbeat()

	if cliErr != nil {
		panic(cliErr)
	}

	// create the hb
	req := hb.AddHeartbeatRequest{Name: samples.RandStringWithPrefix("Test", 4)}
	response, hbErr := hbCli.Add(req)

	if hbErr != nil {
		panic(hbErr)
	}

	fmt.Printf("Heartbeat created\n")
	fmt.Printf("-----------------\n")
	fmt.Printf("id: %s\n", response.ID)
	fmt.Printf("status: %s\n", response.Status)
	fmt.Printf("code: %d\n", response.Code)

	// enable the hb
	getReq := hb.GetHeartbeatRequest{ID: response.ID}
	getResp, getErr := hbCli.Get(getReq)
	if getErr != nil {
		panic(getErr)
	}

	fmt.Printf("Heartbeat details\n")
	fmt.Printf("-----------------\n")
	fmt.Printf("Id: %s\n", getResp.ID)
	fmt.Printf("Name: %s\n", getResp.Name)
	fmt.Printf("Status: %s\n", getResp.Status)
	fmt.Printf("Description: %s\n", getResp.Description)
	fmt.Printf("Enabled?: %t\n", getResp.Enabled)
	fmt.Printf("Last Heartbeat: %d\n", getResp.LastHeartbeat)
	fmt.Printf("Interval: %d\n", getResp.Interval)
	fmt.Printf("Interval Unit: %s\n", getResp.IntervalUnit)
	fmt.Printf("Expired?: %t\n", getResp.Expired)
}
开发者ID:victortrac,项目名称:opsgenie-go-sdk,代码行数:43,代码来源:heartbeat_create_and_get.go


示例20: main

func main() {
	cli := new(ogcli.OpsGenieClient)
	cli.SetAPIKey(constants.APIKey)

	schCli, cliErr := cli.Schedule()

	if cliErr != nil {
		panic(cliErr)
	}

	req := sch.ListSchedulesRequest{}
	response, schErr := schCli.List(req)

	if schErr != nil {
		panic(schErr)
	}
	for _, sch := range response.Schedules {
		fmt.Printf("Id: %s\n", sch.Id)
		fmt.Printf("Name: %s\n", sch.Name)
		fmt.Printf("Team: %s\n", sch.Team)
		fmt.Printf("Rules:\n")
		for _, rule := range sch.Rules {
			fmt.Printf("Id: %s\n", rule.Id)
			fmt.Printf("Name: %s\n", rule.Name)
			fmt.Printf("StartDate: %s\n", rule.StartDate)
			fmt.Printf("EndDate: %s\n", rule.EndDate)
			fmt.Printf("Rotation Type: %s\n", rule.RotationType)
			fmt.Printf("Rotation Length: %d\n", rule.RotationLength)
			fmt.Printf("Participants: %s\n", rule.Participants)
			fmt.Printf("Restrictions:\n")
			for _, restriction := range rule.Restrictions {
				fmt.Printf("Start Day: %s\n", restriction.StartDay)
				fmt.Printf("Start Time: %s\n", restriction.StartTime)
				fmt.Printf("End Day: %s\n", restriction.EndDay)
				fmt.Printf("End Time: %s\n", restriction.EndTime)
				fmt.Printf("\n")
			}
			fmt.Printf("\n")
		}
		fmt.Printf("\n")
	}
}
开发者ID:tablexi,项目名称:opsgenie-go-sdk,代码行数:42,代码来源:schedule_list.go



注:本文中的github.com/opsgenie/opsgenie-go-sdk/client.OpsGenieClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang logging.Logger函数代码示例发布时间:2022-05-28
下一篇:
Golang pipeline.StandardModule类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap