Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MergeIncidents (using Incident) #114

Merged
merged 1 commit into from
Aug 13, 2019

Conversation

atomicules
Copy link
Contributor

Allows for merging of incidents as follows:

incidents := make([]string, 3)
incidents[0] = "PXXXXXX"
incidents[1] = "PYYYYYY"
incidents[2] = "PZZZZZZ"

first := incidents[0]
rest := incidents[1:]

tomerge := make([]pagerduty.APIObject, 0)

for i := range rest {
    inc := pagerduty.Incident{
	APIObject: pagerduty.APIObject{
	    ID:   rest[i],
	    Type: "incident_reference",
	},
    }
    tomerge = append(tomerge, inc)
}
result := client.MergeIncidents(email, first, tomerge)

Note that this option (using pagerduty.Incident most closely matches the existing ManageIncident, but since Merge literally only requires the id and the type of "incident_reference" I've also got an option 2 branch which uses pagerduty.APIObject; I personally think that option 2 is a bit cleaner for actual creation of "objects" for merging, but I guess doesn't sit as well with the existing ManageIncidents function.

Allows for merging of incidents as follows:

    incidents := make([]string, 3)
    incidents[0] = "PXXXXXX"
    incidents[1] = "PYYYYYY"
    incidents[2] = "PZZZZZZ"

    first := incidents[0]
    rest := incidents[1:]

    tomerge := make([]pagerduty.APIObject, 0)

    for i := range rest {
	    inc := pagerduty.Incident{
		APIObject: pagerduty.APIObject{
		    ID:   rest[i],
		    Type: "incident_reference",
		},
	    }
	    tomerge = append(tomerge, inc)
    }
    result := client.MergeIncidents(email, first, tomerge)
dobs added a commit to dobs/go-pagerduty that referenced this pull request Mar 19, 2019
This branch incorporates a bunch of old un-merged PRs from upstream, specifically:

- PagerDuty#72
- PagerDuty#73
- PagerDuty#74
- PagerDuty#75
- PagerDuty#78
- PagerDuty#91
- PagerDuty#93
- PagerDuty#97
- PagerDuty#104
- PagerDuty#106
- PagerDuty#108
- PagerDuty#113
- PagerDuty#114
- PagerDuty#126
- PagerDuty#127
- PagerDuty#130
- PagerDuty#132
- PagerDuty#137
- PagerDuty#138
- PagerDuty#140
- PagerDuty#143

It doesn't attempt to merge, due to potential complexity:

- PagerDuty#48
- PagerDuty#99
- PagerDuty#134

And skips the following as it was picked up as part of pulling in the above merged PRs:

- PagerDuty#133

Will have subsequent PRs for cleanup, specifically:
- Reducing duplicate code.
- Standardizing response and error handling.

Followed by more janitorial and refactor-oriented changes.
@stmcallister stmcallister merged commit 5f7f220 into PagerDuty:master Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants