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

chore: changetracking deployment customattributes #1047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions pkg/changetracking/changetracking_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ func TestChangeTrackingCreateDeployment_Basic(t *testing.T) {

a := newIntegrationTestClient(t)

var customAttributes = map[string]string{
"test": "123",
"test2": "456",
}

input := ChangeTrackingDeploymentInput{
Changelog: "test",
Commit: "12345a",
DeepLink: "newrelic-client-go",
DeploymentType: ChangeTrackingDeploymentTypeTypes.BASIC,
Description: "This is a test description",
EntityGUID: common.EntityGUID(testhelpers.IntegrationTestApplicationEntityGUID),
GroupId: "deployment",
Timestamp: nrtime.EpochMilliseconds(time.Now()),
User: "newrelic-go-client",
Version: "0.0.1",
Changelog: "test",
Commit: "12345a",
CustomAttributes: &customAttributes,
DeepLink: "newrelic-client-go",
DeploymentType: ChangeTrackingDeploymentTypeTypes.BASIC,
Description: "This is a test description",
EntityGUID: common.EntityGUID(testhelpers.IntegrationTestApplicationEntityGUID),
GroupId: "deployment",
Timestamp: nrtime.EpochMilliseconds(time.Now()),
User: "newrelic-go-client",
Version: "0.0.1",
}

res, err := a.ChangeTrackingCreateDeployment(input)
Expand Down
37 changes: 37 additions & 0 deletions pkg/changetracking/changetracking_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package changetracking

import (
"github.com/newrelic/newrelic-client-go/v2/pkg/common"
"github.com/newrelic/newrelic-client-go/v2/pkg/nrtime"
)

/*
Since we can't yet generate the CustomAttributes type with Tutone,
defer ChangeTrackingDeploymentInput placement into types.go until CustomAttributes GA.
*/

// ChangeTrackingDeploymentInput - A deployment.
type ChangeTrackingDeploymentInput struct {
// A URL for the changelog or list of changes if not linkable.
Changelog string `json:"changelog,omitempty"`
// The commit identifier, for example, a Git commit SHA.
Commit string `json:"commit,omitempty"`
// A list of key:value attribute pairs
CustomAttributes *map[string]string `json:"customAttributes,omitempty"`
// A link back to the system generating the deployment.
DeepLink string `json:"deepLink,omitempty"`
// The type of deployment, for example, ‘Blue green’ or ‘Rolling’.
DeploymentType ChangeTrackingDeploymentType `json:"deploymentType,omitempty"`
// A description of the deployment.
Description string `json:"description,omitempty"`
// The NR1 entity that was deployed.
EntityGUID common.EntityGUID `json:"entityGuid"`
// String that can be used to correlate two or more events.
GroupId string `json:"groupId,omitempty"`
// The start time of the deployment, the number of milliseconds since the Unix epoch. Defaults to now
Timestamp nrtime.EpochMilliseconds `json:"timestamp,omitempty"`
// Username of the deployer or bot.
User string `json:"user,omitempty"`
// The version of the deployed software, for example, something like v1.1
Version string `json:"version"`
}
24 changes: 0 additions & 24 deletions pkg/changetracking/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,3 @@ type ChangeTrackingDeployment struct {
// The version of the deployed software, for example, something like v1.1
Version string `json:"version"`
}

// ChangeTrackingDeploymentInput - A deployment.
type ChangeTrackingDeploymentInput struct {
// A URL for the changelog or list of changes if not linkable.
Changelog string `json:"changelog,omitempty"`
// The commit identifier, for example, a Git commit SHA.
Commit string `json:"commit,omitempty"`
// A link back to the system generating the deployment.
DeepLink string `json:"deepLink,omitempty"`
// The type of deployment, for example, ‘Blue green’ or ‘Rolling’.
DeploymentType ChangeTrackingDeploymentType `json:"deploymentType,omitempty"`
// A description of the deployment.
Description string `json:"description,omitempty"`
// The NR1 entity that was deployed.
EntityGUID common.EntityGUID `json:"entityGuid"`
// String that can be used to correlate two or more events.
GroupId string `json:"groupId,omitempty"`
// The start time of the deployment, the number of milliseconds since the Unix epoch. Defaults to now
Timestamp nrtime.EpochMilliseconds `json:"timestamp,omitempty"`
// Username of the deployer or bot.
User string `json:"user,omitempty"`
// The version of the deployed software, for example, something like v1.1
Version string `json:"version"`
}