-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d3d458
commit 1454da5
Showing
5 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package agent | ||
|
||
import ( | ||
"github.com/newrelic/newrelic-client-go/v2/internal/http" | ||
"github.com/newrelic/newrelic-client-go/v2/pkg/config" | ||
"github.com/newrelic/newrelic-client-go/v2/pkg/logging" | ||
) | ||
|
||
type Agent struct { | ||
client http.Client | ||
logger logging.Logger | ||
} | ||
|
||
func New(config config.Config) Agent { | ||
return Agent{ | ||
client: http.NewClient(config), | ||
logger: config.GetLogger(), | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//go:build integration | ||
|
||
package agent | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func newAgentIntegrationTestClient(t *testing.T) Agent { | ||
tc := testhelpers.NewIntegrationTestConfig(t) | ||
|
||
return New(tc) | ||
} | ||
|
||
func TestIntegrationGetCurrentAgentRelease(t *testing.T) { | ||
t.Parallel() | ||
|
||
client := newAgentIntegrationTestClient(t) | ||
|
||
agentName := AgentReleasesFilterTypes.GO | ||
|
||
getResult, err := client.GetCurrentAgentRelease(agentName) | ||
require.NoError(t, err) | ||
require.NotNil(t, getResult) | ||
|
||
require.NotNil(t, getResult.Bugs) | ||
require.NotNil(t, getResult.Date) | ||
require.NotNil(t, getResult.DownloadLink) | ||
require.NotNil(t, getResult.EolDate) | ||
require.NotNil(t, getResult.Features) | ||
require.NotNil(t, getResult.Security) | ||
require.NotNil(t, getResult.Slug) | ||
require.NotNil(t, getResult.Version) | ||
} | ||
|
||
func TestIntegrationGetCurrentAgentRelease_Invalid(t *testing.T) { | ||
t.Parallel() | ||
|
||
client := newAgentIntegrationTestClient(t) | ||
|
||
var agentName AgentReleasesFilter = "ASDF" | ||
|
||
getResult, err := client.GetCurrentAgentRelease(agentName) | ||
require.Error(t, err) | ||
require.Nil(t, getResult) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Code generated by tutone: DO NOT EDIT | ||
package agent | ||
|
||
// AgentReleasesFilter - Agent Release Filter | ||
type AgentReleasesFilter string | ||
|
||
var AgentReleasesFilterTypes = struct { | ||
// Android agent | ||
ANDROID AgentReleasesFilter | ||
// Browser agent | ||
BROWSER AgentReleasesFilter | ||
// .NET agent | ||
DOTNET AgentReleasesFilter | ||
// Elixir agent | ||
ELIXIR AgentReleasesFilter | ||
// Go agent | ||
GO AgentReleasesFilter | ||
// Infrastructure agent | ||
INFRASTRUCTURE AgentReleasesFilter | ||
// iOS agent | ||
IOS AgentReleasesFilter | ||
// Java agent | ||
JAVA AgentReleasesFilter | ||
// Node.js agent | ||
NODEJS AgentReleasesFilter | ||
// PHP agent | ||
PHP AgentReleasesFilter | ||
// Python agent | ||
PYTHON AgentReleasesFilter | ||
// Ruby agent | ||
RUBY AgentReleasesFilter | ||
// C SDK | ||
SDK AgentReleasesFilter | ||
}{ | ||
// Android agent | ||
ANDROID: "ANDROID", | ||
// Browser agent | ||
BROWSER: "BROWSER", | ||
// .NET agent | ||
DOTNET: "DOTNET", | ||
// Elixir agent | ||
ELIXIR: "ELIXIR", | ||
// Go agent | ||
GO: "GO", | ||
// Infrastructure agent | ||
INFRASTRUCTURE: "INFRASTRUCTURE", | ||
// iOS agent | ||
IOS: "IOS", | ||
// Java agent | ||
JAVA: "JAVA", | ||
// Node.js agent | ||
NODEJS: "NODEJS", | ||
// PHP agent | ||
PHP: "PHP", | ||
// Python agent | ||
PYTHON: "PYTHON", | ||
// Ruby agent | ||
RUBY: "RUBY", | ||
// C SDK | ||
SDK: "SDK", | ||
} | ||
|
||
// AgentReleasesAgentRelease - Information about an Agent release | ||
type AgentReleasesAgentRelease struct { | ||
// Patch for a bug | ||
Bugs []string `json:"bugs,omitempty"` | ||
// The date of the release | ||
Date Date `json:"date,omitempty"` | ||
// Link to agent distribution | ||
DownloadLink string `json:"downloadLink,omitempty"` | ||
// The date the release will reach the end of its life. See [New Relic's EOL Policy](https://docs.newrelic.com/docs/licenses/end-of-life/notification-changes-new-relic-saas-features-distributed-software/) for details | ||
EolDate Date `json:"eolDate,omitempty"` | ||
// New feature or instrumentation | ||
Features []string `json:"features,omitempty"` | ||
// Fix for a security vulnerability | ||
Security []string `json:"security,omitempty"` | ||
// The release note's location on the docs website. The full URL would be prefixed with [https://docs.newrelic.com](https://docs.newrelic.com/) | ||
Slug string `json:"slug,omitempty"` | ||
// The version of the release | ||
Version string `json:"version,omitempty"` | ||
} | ||
|
||
// DocumentationFields - | ||
type DocumentationFields struct { | ||
// View a list of all releases for the provided Agent | ||
AgentReleases []AgentReleasesAgentRelease `json:"agentReleases,omitempty"` | ||
// The current release of the provided Agent | ||
CurrentAgentRelease AgentReleasesAgentRelease `json:"currentAgentRelease,omitempty"` | ||
} | ||
|
||
type currentAgentReleaseResponse struct { | ||
DocumentationFields DocumentationFields `json:"docs"` | ||
} | ||
|
||
// Date - The `Date` scalar represents a date. The `Date` appears as an ISO8601 formatted string. | ||
type Date string |