chore: remove name from service clone org resources
these functions are not hit by the clipull/19457/head
parent
f5731b8397
commit
1d9a5623e3
|
@ -670,7 +670,7 @@ func (s *Service) Export(ctx context.Context, setters ...ExportOptFn) (*Template
|
|||
func (s *Service) cloneOrgResources(ctx context.Context, orgID influxdb.ID, resourceKinds []Kind) ([]ResourceToClone, error) {
|
||||
var resources []ResourceToClone
|
||||
for _, resGen := range s.filterOrgResourceKinds(resourceKinds) {
|
||||
existingResources, err := resGen.cloneFn(ctx, orgID, "")
|
||||
existingResources, err := resGen.cloneFn(ctx, orgID)
|
||||
if err != nil {
|
||||
return nil, ierrors.Wrap(err, "finding "+string(resGen.resType))
|
||||
}
|
||||
|
@ -680,15 +680,9 @@ func (s *Service) cloneOrgResources(ctx context.Context, orgID influxdb.ID, reso
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgBuckets(ctx context.Context, orgID influxdb.ID, name string) ([]ResourceToClone, error) {
|
||||
var n *string
|
||||
if len(name) > 0 {
|
||||
n = &name
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgBuckets(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
buckets, _, err := s.bucketSVC.FindBuckets(ctx, influxdb.BucketFilter{
|
||||
OrganizationID: &orgID,
|
||||
Name: n,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -708,15 +702,9 @@ func (s *Service) cloneOrgBuckets(ctx context.Context, orgID influxdb.ID, name s
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgChecks(ctx context.Context, orgID influxdb.ID, name string) ([]ResourceToClone, error) {
|
||||
var n *string
|
||||
if len(name) > 0 {
|
||||
n = &name
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgChecks(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
checks, _, err := s.checkSVC.FindChecks(ctx, influxdb.CheckFilter{
|
||||
OrgID: &orgID,
|
||||
Name: n,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -733,7 +721,7 @@ func (s *Service) cloneOrgChecks(ctx context.Context, orgID influxdb.ID, name st
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgDashboards(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgDashboards(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
dashs, _, err := s.dashSVC.FindDashboards(ctx, influxdb.DashboardFilter{
|
||||
OrganizationID: &orgID,
|
||||
}, influxdb.FindOptions{Limit: 100})
|
||||
|
@ -751,13 +739,10 @@ func (s *Service) cloneOrgDashboards(ctx context.Context, orgID influxdb.ID, _ s
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgLabels(ctx context.Context, orgID influxdb.ID, name string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgLabels(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
filter := influxdb.LabelFilter{
|
||||
OrgID: &orgID,
|
||||
}
|
||||
if len(name) > 0 {
|
||||
filter.Name = name
|
||||
}
|
||||
|
||||
// todo: if this was ever called, it would error, 100 is the limit.
|
||||
labels, err := s.labelSVC.FindLabels(ctx, filter, influxdb.FindOptions{Limit: 10000})
|
||||
|
@ -776,7 +761,7 @@ func (s *Service) cloneOrgLabels(ctx context.Context, orgID influxdb.ID, name st
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgNotificationEndpoints(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgNotificationEndpoints(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
endpoints, _, err := s.endpointSVC.FindNotificationEndpoints(ctx, influxdb.NotificationEndpointFilter{
|
||||
OrgID: &orgID,
|
||||
})
|
||||
|
@ -795,7 +780,7 @@ func (s *Service) cloneOrgNotificationEndpoints(ctx context.Context, orgID influ
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgNotificationRules(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgNotificationRules(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
rules, _, err := s.ruleSVC.FindNotificationRules(ctx, influxdb.NotificationRuleFilter{
|
||||
OrgID: &orgID,
|
||||
})
|
||||
|
@ -814,7 +799,7 @@ func (s *Service) cloneOrgNotificationRules(ctx context.Context, orgID influxdb.
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgTasks(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgTasks(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
tasks, err := s.getAllTasks(ctx, orgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -859,7 +844,7 @@ func (s *Service) cloneOrgTasks(ctx context.Context, orgID influxdb.ID, _ string
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgTelegrafs(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgTelegrafs(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
teles, _, err := s.teleSVC.FindTelegrafConfigs(ctx, influxdb.TelegrafConfigFilter{OrgID: &orgID})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -875,7 +860,7 @@ func (s *Service) cloneOrgTelegrafs(ctx context.Context, orgID influxdb.ID, _ st
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
func (s *Service) cloneOrgVariables(ctx context.Context, orgID influxdb.ID, _ string) ([]ResourceToClone, error) {
|
||||
func (s *Service) cloneOrgVariables(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
vars, err := s.varSVC.FindVariables(ctx, influxdb.VariableFilter{
|
||||
OrganizationID: &orgID,
|
||||
}, influxdb.FindOptions{Limit: 10000})
|
||||
|
@ -895,7 +880,7 @@ func (s *Service) cloneOrgVariables(ctx context.Context, orgID influxdb.ID, _ st
|
|||
}
|
||||
|
||||
type (
|
||||
cloneResFn func(context.Context, influxdb.ID, string) ([]ResourceToClone, error)
|
||||
cloneResFn func(context.Context, influxdb.ID) ([]ResourceToClone, error)
|
||||
resClone struct {
|
||||
resType influxdb.ResourceType
|
||||
cloneFn cloneResFn
|
||||
|
|
Loading…
Reference in New Issue