add retention policy name to bucket

pull/10616/head
Michael Desa 2018-08-02 16:55:51 -04:00 committed by Andrew Watkins
parent ffe645d6e2
commit fc382defb8
3 changed files with 13 additions and 9 deletions

View File

@ -7,11 +7,12 @@ import (
// Bucket is a bucket. 🎉
type Bucket struct {
ID ID `json:"id,omitempty"`
OrganizationID ID `json:"organizationID,omitempty"`
Organization string `json:"organization,omitempty"`
Name string `json:"name"`
RetentionPeriod time.Duration `json:"retentionPeriod"`
ID ID `json:"id,omitempty"`
OrganizationID ID `json:"organizationID,omitempty"`
Organization string `json:"organization,omitempty"`
Name string `json:"name"`
RetentionPolicyName string `json:"rp,omitempty"` // This to support v1 sources
RetentionPeriod time.Duration `json:"retentionPeriod"`
}
// BucketService represents a service for managing bucket data.

View File

@ -114,14 +114,16 @@ const tagsetFilter = (filter: SchemaFilter[]): string => {
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 type = "flux"
try {
const response = await AJAX({
method: 'POST',
url,
data: {
script,
type,
query,
},
})

View File

@ -45,8 +45,9 @@ func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketF
}
b := &platform.Bucket{
// TODO(desa): what to do about IDs?
RetentionPeriod: d,
Name: fmt.Sprintf("%v.%v", db.Name, rp.Name),
RetentionPeriod: d,
Name: db.Name,
RetentionPolicyName: rp.Name,
}
bs = append(bs, b)