Skip to content

Commit

Permalink
feat: addition of client code corresponding to packages customeradmin…
Browse files Browse the repository at this point in the history
…istration +2 (#1126)
  • Loading branch information
pranav-new-relic authored Apr 15, 2024
1 parent 8c11550 commit 0e073a6
Show file tree
Hide file tree
Showing 21 changed files with 4,600 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ jobs:
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
NEW_RELIC_REGION: ${{ secrets.NEW_RELIC_REGION }}
INTEGRATION_TESTING_AWS_ARN: ${{ secrets.INTEGRATION_TESTING_AWS_ARN }}
INTEGRATION_TESTING_NEW_RELIC_ORGANIZATION_ID: ${{ secrets.INTEGRATION_TESTING_NEW_RELIC_ORGANIZATION_ID}}
INTEGRATION_TESTING_NEW_RELIC_AUTHENTICATION_DOMAIN_ID: ${{ secrets.INTEGRATION_TESTING_NEW_RELIC_AUTHENTICATION_DOMAIN_ID}}

- name: Report integration test coverage via Codecov
uses: codecov/codecov-action@v3
Expand Down
203 changes: 203 additions & 0 deletions .tutone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,209 @@ packages:
- name: DateTime
field_type_override: nrtime.DateTime
skip_type_create: true

- name: authorizationmanagement
path: pkg/authorizationmanagement
import_path: github.com/newrelic/newrelic-client-go/v2/pkg/authorizationmanagement
generators:
- typegen
- nerdgraphclient
imports:
- github.com/newrelic/newrelic-client-go/v2/pkg/accounts
- github.com/newrelic/newrelic-client-go/v2/pkg/common
- github.com/newrelic/newrelic-client-go/v2/pkg/nrtime
- github.com/newrelic/newrelic-client-go/v2/pkg/users
queries:
- path: ["actor", "organization", "authorizationManagement"]
endpoints:
- name: roles
max_query_field_depth: 4
mutations:
- name: authorizationManagementGrantAccess
max_query_field_depth: 3
- name: authorizationManagementRevokeAccess
max_query_field_depth: 3
types:
- name: ID
field_type_override: string
skip_type_create: true
- name: DateTime
field_type_override: nrtime.DateTime
skip_type_create: true

- name: organization
path: pkg/organization
import_path: github.com/newrelic/newrelic-client-go/v2/pkg/organization
generators:
- typegen
- nerdgraphclient
imports:
- github.com/newrelic/newrelic-client-go/v2/pkg/accounts
- github.com/newrelic/newrelic-client-go/v2/pkg/common
- github.com/newrelic/newrelic-client-go/v2/pkg/nrtime
- github.com/newrelic/newrelic-client-go/v2/pkg/users
queries: []
mutations:
- name: organizationCreate
max_query_field_depth: 2
- name: organizationUpdate
max_query_field_depth: 2
# - name: organizationCreateSharedAccount
# max_query_field_depth: 2
# - name: organizationRevokeSharedAccount
# max_query_field_depth: 2
# - name: organizationUpdateSharedAccount
# max_query_field_depth: 2
types:
- name: OrganizationNewManagedAccountInput
field_type_override: "*OrganizationNewManagedAccountInput"
- name: OrganizationSharedAccountInput
field_type_override: "*OrganizationSharedAccountInput"
- name: ID
field_type_override: string
skip_type_create: true
- name: DateTime
field_type_override: nrtime.DateTime
skip_type_create: true

- name: customeradministration
path: pkg/customeradministration
import_path: github.com/newrelic/newrelic-client-go/v2/pkg/customeradministration
generators:
- typegen
- nerdgraphclient
imports:
- github.com/newrelic/newrelic-client-go/v2/pkg/accounts
- github.com/newrelic/newrelic-client-go/v2/pkg/common
- github.com/newrelic/newrelic-client-go/v2/pkg/nrtime
- github.com/newrelic/newrelic-client-go/v2/pkg/users
queries:
- path: ["customerAdministration"]
endpoints:
- name: accountShares
max_query_field_depth: 4
- name: accounts
max_query_field_depth: 4
- name: authenticationDomains
max_query_field_depth: 4
- name: consumption
max_query_field_depth: 4
- name: contracts
max_query_field_depth: 4
- name: grants
max_query_field_depth: 4
- name: groups
max_query_field_depth: 4
- name: jobs
max_query_field_depth: 4
- name: organizations
max_query_field_depth: 4
- name: permissions
max_query_field_depth: 4
- name: roles
max_query_field_depth: 4
- name: user
max_query_field_depth: 4
- name: users
max_query_field_depth: 4
- path: ["customerAdministration", "jobs"]
endpoints:
- name: organizationCreateAsyncResults
max_query_field_depth: 4
types:
- name: OrganizationAccountShareFilterInput
- name: OrganizationAccountShareSortInput
- name: OrganizationAccountFilterInput
- name: OrganizationAccountSortInput
- name: OrganizationAuthenticationDomainFilterInput
- name: OrganizationAuthenticationDomainSortInput
- name: OrganizationCustomerContractFilterInput
- name: MultiTenantAuthorizationGrantFilterInputExpression
- name: MultiTenantAuthorizationGrantSortInput
- name: MultiTenantIdentityGroupFilterInput
- name: MultiTenantIdentityGroupSortInput
- name: OrganizationCustomerOrganizationFilterInput
- name: MultiTenantAuthorizationPermissionFilter
- name: MultiTenantAuthorizationRoleFilterInputExpression
- name: MultiTenantAuthorizationRoleSortInput
- name: MultiTenantIdentityUserFilterInput
- name: MultiTenantIdentityUserSortInput
# overrides associated with types starting with MultiTenantIdentityGroupFilterInput
# which is used in the 'groups' endpoint in customerAdministration
- name: MultiTenantIdentityAllowsCapabilityInput
field_type_override: "*MultiTenantIdentityAllowsCapabilityInput"
- name: MultiTenantIdentityAuthenticationDomainIdInput
field_type_override: "*MultiTenantIdentityAuthenticationDomainIdInput"
- name: MultiTenantIdentityGroupIdInput
field_type_override: "*MultiTenantIdentityGroupIdInput"
- name: MultiTenantIdentityGroupMemberIdInput
field_type_override: "*MultiTenantIdentityGroupMemberIdInput"
- name: MultiTenantIdentityGroupNameInput
field_type_override: "*MultiTenantIdentityGroupNameInput"
- name: MultiTenantIdentityOrganizationIdInput
field_type_override: "*MultiTenantIdentityOrganizationIdInput"
# overrides associated with types starting with MultiTenantIdentityUserFilterInput
# which is used in the 'users' endpoint in customerAdministration
- name: MultiTenantIdentityUserEmailInput
field_type_override: "*MultiTenantIdentityUserEmailInput"
- name: MultiTenantIdentityEmailVerificationStateInput
field_type_override: "*MultiTenantIdentityEmailVerificationStateInput"
- name: MultiTenantIdentityUserIdInput
field_type_override: "*MultiTenantIdentityUserIdInput"
- name: MultiTenantIdentityUserGroupIdInput
field_type_override: "*MultiTenantIdentityUserGroupIdInput"
- name: MultiTenantIdentityUserNameInput
field_type_override: "*MultiTenantIdentityUserNameInput"
- name: MultiTenantIdentityPendingUpgradeRequestInput
field_type_override: "*MultiTenantIdentityPendingUpgradeRequestInput"
# overrides associated with types starting with MultiTenantAuthorizationRoleFilterInputExpression
# which is used in the 'roles' endpoint in customerAdministration
- name: MultiTenantAuthorizationRoleGroupIdInputFilter
field_type_override: "*MultiTenantAuthorizationRoleGroupIdInputFilter"
- name: MultiTenantAuthorizationRoleIdInputFilter
field_type_override: "*MultiTenantAuthorizationRoleIdInputFilter"
- name: MultiTenantAuthorizationRoleNameInputFilter
field_type_override: "*MultiTenantAuthorizationRoleNameInputFilter"
- name: MultiTenantAuthorizationRoleOrganizationIdInputFilter
field_type_override: "*MultiTenantAuthorizationRoleOrganizationIdInputFilter"
- name: MultiTenantAuthorizationRoleScopeInputFilter
field_type_override: "*MultiTenantAuthorizationRoleScopeInputFilter"
- name: MultiTenantAuthorizationRoleTypeInputFilter
field_type_override: "*MultiTenantAuthorizationRoleTypeInputFilter"
#####
# overrides associated with types starting with MultiTenantAuthorizationGrantFilterInputExpression{
# which is used in the 'grants' endpoint in customerAdministration
- name: MultiTenantAuthorizationGrantAuthenticationDomainIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantAuthenticationDomainIdInputFilter"
- name: MultiTenantAuthorizationGrantGroupIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantGroupIdInputFilter"
- name: MultiTenantAuthorizationGrantIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantIdInputFilter"
- name: MultiTenantAuthorizationGrantOrganizationIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantOrganizationIdInputFilter"
- name: MultiTenantAuthorizationGrantRoleIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantRoleIdInputFilter"
- name: MultiTenantAuthorizationGrantScopeIdInputFilter
field_type_override: "*MultiTenantAuthorizationGrantScopeIdInputFilter"
- name: MultiTenantAuthorizationGrantScopeTypeInputFilter
field_type_override: "*MultiTenantAuthorizationGrantScopeTypeInputFilter"
######
# overrides associated with types starting with OrganizationOrganizationCreateAsyncResultFilterInput
# which is used in the 'organizationCreateAsyncResults' endpoint in customerAdministration > jobs
- name: OrganizationOrganizationCreateJobCustomerIdInput
field_type_override: "*OrganizationOrganizationCreateJobCustomerIdInput"
- name: OrganizationOrganizationCreateJobIdInput
field_type_override: "*OrganizationOrganizationCreateJobIdInput"
- name: OrganizationOrganizationCreateJobStatusInput
field_type_override: "*OrganizationOrganizationCreateJobStatusInput"

- name: ID
field_type_override: string
skip_type_create: true
- name: DateTime
field_type_override: nrtime.DateTime
skip_type_create: true

generators:
- name: typegen
fileName: "types.go"
Expand Down
117 changes: 63 additions & 54 deletions newrelic/newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
"github.com/newrelic/newrelic-client-go/v2/pkg/alerts"
"github.com/newrelic/newrelic-client-go/v2/pkg/apiaccess"
"github.com/newrelic/newrelic-client-go/v2/pkg/apm"
"github.com/newrelic/newrelic-client-go/v2/pkg/authorizationmanagement"
"github.com/newrelic/newrelic-client-go/v2/pkg/changetracking"
"github.com/newrelic/newrelic-client-go/v2/pkg/cloud"
"github.com/newrelic/newrelic-client-go/v2/pkg/config"
"github.com/newrelic/newrelic-client-go/v2/pkg/customeradministration"
"github.com/newrelic/newrelic-client-go/v2/pkg/dashboards"
"github.com/newrelic/newrelic-client-go/v2/pkg/edge"
"github.com/newrelic/newrelic-client-go/v2/pkg/entities"
Expand All @@ -27,6 +29,7 @@ import (
"github.com/newrelic/newrelic-client-go/v2/pkg/notifications"
"github.com/newrelic/newrelic-client-go/v2/pkg/nrdb"
"github.com/newrelic/newrelic-client-go/v2/pkg/nrqldroprules"
"github.com/newrelic/newrelic-client-go/v2/pkg/organization"
"github.com/newrelic/newrelic-client-go/v2/pkg/plugins"
"github.com/newrelic/newrelic-client-go/v2/pkg/servicelevel"
"github.com/newrelic/newrelic-client-go/v2/pkg/synthetics"
Expand All @@ -37,33 +40,36 @@ import (

// NewRelic is a collection of New Relic APIs.
type NewRelic struct {
AccountManagement accountmanagement.Accountmanagement
AgentApplications agentapplications.AgentApplications
Accounts accounts.Accounts
Alerts alerts.Alerts
APIAccess apiaccess.APIAccess
APM apm.APM
ChangeTracking changetracking.Changetracking
Cloud cloud.Cloud
Dashboards dashboards.Dashboards
Edge edge.Edge
Entities entities.Entities
Events events.Events
EventsToMetrics eventstometrics.EventsToMetrics
InstallEvents installevents.Installevents
Logs logs.Logs
Logconfigurations logconfigurations.Logconfigurations
NerdGraph nerdgraph.NerdGraph
NerdStorage nerdstorage.NerdStorage
Notifications notifications.Notifications
Nrdb nrdb.Nrdb
Nrqldroprules nrqldroprules.Nrqldroprules
Plugins plugins.Plugins
ServiceLevel servicelevel.Servicelevel
Synthetics synthetics.Synthetics
UserManagement usermanagement.Usermanagement
Workflows workflows.Workflows
Workloads workloads.Workloads
AccountManagement accountmanagement.Accountmanagement
AgentApplications agentapplications.AgentApplications
Accounts accounts.Accounts
Alerts alerts.Alerts
APIAccess apiaccess.APIAccess
APM apm.APM
AuthorizationManagement authorizationmanagement.Authorizationmanagement
ChangeTracking changetracking.Changetracking
Cloud cloud.Cloud
CustomerAdministration customeradministration.Customeradministration
Dashboards dashboards.Dashboards
Edge edge.Edge
Entities entities.Entities
Events events.Events
EventsToMetrics eventstometrics.EventsToMetrics
InstallEvents installevents.Installevents
Logs logs.Logs
Logconfigurations logconfigurations.Logconfigurations
NerdGraph nerdgraph.NerdGraph
NerdStorage nerdstorage.NerdStorage
Notifications notifications.Notifications
Nrdb nrdb.Nrdb
Nrqldroprules nrqldroprules.Nrqldroprules
Organization organization.Organization
Plugins plugins.Plugins
ServiceLevel servicelevel.Servicelevel
Synthetics synthetics.Synthetics
UserManagement usermanagement.Usermanagement
Workflows workflows.Workflows
Workloads workloads.Workloads

config config.Config
}
Expand All @@ -80,33 +86,36 @@ func New(opts ...ConfigOption) (*NewRelic, error) {
nr := &NewRelic{
config: cfg,

AccountManagement: accountmanagement.New(cfg),
AgentApplications: agentapplications.New(cfg),
Accounts: accounts.New(cfg),
Alerts: alerts.New(cfg),
APIAccess: apiaccess.New(cfg),
APM: apm.New(cfg),
ChangeTracking: changetracking.New(cfg),
Cloud: cloud.New(cfg),
Dashboards: dashboards.New(cfg),
Edge: edge.New(cfg),
Entities: entities.New(cfg),
Events: events.New(cfg),
EventsToMetrics: eventstometrics.New(cfg),
InstallEvents: installevents.New(cfg),
Logs: logs.New(cfg),
Logconfigurations: logconfigurations.New(cfg),
NerdGraph: nerdgraph.New(cfg),
NerdStorage: nerdstorage.New(cfg),
Notifications: notifications.New(cfg),
Nrdb: nrdb.New(cfg),
Nrqldroprules: nrqldroprules.New(cfg),
Plugins: plugins.New(cfg),
ServiceLevel: servicelevel.New(cfg),
Synthetics: synthetics.New(cfg),
UserManagement: usermanagement.New(cfg),
Workflows: workflows.New(cfg),
Workloads: workloads.New(cfg),
AccountManagement: accountmanagement.New(cfg),
AgentApplications: agentapplications.New(cfg),
Accounts: accounts.New(cfg),
Alerts: alerts.New(cfg),
APIAccess: apiaccess.New(cfg),
APM: apm.New(cfg),
AuthorizationManagement: authorizationmanagement.New(cfg),
ChangeTracking: changetracking.New(cfg),
Cloud: cloud.New(cfg),
CustomerAdministration: customeradministration.New(cfg),
Dashboards: dashboards.New(cfg),
Edge: edge.New(cfg),
Entities: entities.New(cfg),
Events: events.New(cfg),
EventsToMetrics: eventstometrics.New(cfg),
InstallEvents: installevents.New(cfg),
Logs: logs.New(cfg),
Logconfigurations: logconfigurations.New(cfg),
NerdGraph: nerdgraph.New(cfg),
NerdStorage: nerdstorage.New(cfg),
Notifications: notifications.New(cfg),
Nrdb: nrdb.New(cfg),
Nrqldroprules: nrqldroprules.New(cfg),
Organization: organization.New(cfg),
Plugins: plugins.New(cfg),
ServiceLevel: servicelevel.New(cfg),
Synthetics: synthetics.New(cfg),
UserManagement: usermanagement.New(cfg),
Workflows: workflows.New(cfg),
Workloads: workloads.New(cfg),
}

return nr, nil
Expand Down
24 changes: 24 additions & 0 deletions pkg/authorizationmanagement/authorizationmanagement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package authorizationmanagement

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 Authorizationmanagement struct {
client http.Client
logger logging.Logger
config config.Config
}

func New(config config.Config) Authorizationmanagement {
client := http.NewClient(config)

pkg := Authorizationmanagement{
client: client,
logger: config.GetLogger(),
config: config,
}
return pkg
}
Loading

0 comments on commit 0e073a6

Please sign in to comment.