add retention policy name to bucket
parent
ffe645d6e2
commit
fc382defb8
11
bucket.go
11
bucket.go
|
@ -7,11 +7,12 @@ import (
|
||||||
|
|
||||||
// Bucket is a bucket. 🎉
|
// Bucket is a bucket. 🎉
|
||||||
type Bucket struct {
|
type Bucket struct {
|
||||||
ID ID `json:"id,omitempty"`
|
ID ID `json:"id,omitempty"`
|
||||||
OrganizationID ID `json:"organizationID,omitempty"`
|
OrganizationID ID `json:"organizationID,omitempty"`
|
||||||
Organization string `json:"organization,omitempty"`
|
Organization string `json:"organization,omitempty"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
RetentionPeriod time.Duration `json:"retentionPeriod"`
|
RetentionPolicyName string `json:"rp,omitempty"` // This to support v1 sources
|
||||||
|
RetentionPeriod time.Duration `json:"retentionPeriod"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketService represents a service for managing bucket data.
|
// BucketService represents a service for managing bucket data.
|
||||||
|
|
|
@ -114,14 +114,16 @@ const tagsetFilter = (filter: SchemaFilter[]): string => {
|
||||||
return `|> filter(fn: (r) => ${predicates.join(' and ')} )`
|
return `|> filter(fn: (r) => ${predicates.join(' and ')} )`
|
||||||
}
|
}
|
||||||
|
|
||||||
const metaQuery = async (source: Source, script: string) => {
|
const metaQuery = async (source: Source, query: string) => {
|
||||||
const url = source.links.query
|
const url = source.links.query
|
||||||
|
const type = "flux"
|
||||||
try {
|
try {
|
||||||
const response = await AJAX({
|
const response = await AJAX({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url,
|
url,
|
||||||
data: {
|
data: {
|
||||||
script,
|
type,
|
||||||
|
query,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,9 @@ func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketF
|
||||||
}
|
}
|
||||||
b := &platform.Bucket{
|
b := &platform.Bucket{
|
||||||
// TODO(desa): what to do about IDs?
|
// TODO(desa): what to do about IDs?
|
||||||
RetentionPeriod: d,
|
RetentionPeriod: d,
|
||||||
Name: fmt.Sprintf("%v.%v", db.Name, rp.Name),
|
Name: db.Name,
|
||||||
|
RetentionPolicyName: rp.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
bs = append(bs, b)
|
bs = append(bs, b)
|
||||||
|
|
Loading…
Reference in New Issue