mirror of https://github.com/status-im/consul.git
Rename internal AdminPartition references
This commit finishes replacing references to "AdminPartition" with "Partition". This now matches other uses in the codebase such as the CLI command, HTTP API, and the query parameter.
This commit is contained in:
parent
129d54d060
commit
7811edd055
|
@ -6,8 +6,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdminPartition is the configuration of a single admin partition. Admin Partitions are a Consul Enterprise feature.
|
// Partition is the configuration of a single admin partition. Admin Partitions are a Consul Enterprise feature.
|
||||||
type AdminPartition struct {
|
type Partition struct {
|
||||||
// Name is the name of the Partition.
|
// Name is the name of the Partition.
|
||||||
Name string `json:"Name"`
|
Name string `json:"Name"`
|
||||||
|
|
||||||
|
@ -29,10 +29,6 @@ type AdminPartition struct {
|
||||||
// PartitionDefaultName is the default partition value.
|
// PartitionDefaultName is the default partition value.
|
||||||
const PartitionDefaultName = "default"
|
const PartitionDefaultName = "default"
|
||||||
|
|
||||||
type AdminPartitions struct {
|
|
||||||
Partitions []*AdminPartition
|
|
||||||
}
|
|
||||||
|
|
||||||
// Partitions can be used to manage Partitions in Consul Enterprise..
|
// Partitions can be used to manage Partitions in Consul Enterprise..
|
||||||
type Partitions struct {
|
type Partitions struct {
|
||||||
c *Client
|
c *Client
|
||||||
|
@ -43,7 +39,7 @@ func (c *Client) Partitions() *Partitions {
|
||||||
return &Partitions{c}
|
return &Partitions{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Partitions) Create(ctx context.Context, partition *AdminPartition, q *WriteOptions) (*AdminPartition, *WriteMeta, error) {
|
func (p *Partitions) Create(ctx context.Context, partition *Partition, q *WriteOptions) (*Partition, *WriteMeta, error) {
|
||||||
if partition.Name == "" {
|
if partition.Name == "" {
|
||||||
return nil, nil, fmt.Errorf("Must specify a Name for Partition creation")
|
return nil, nil, fmt.Errorf("Must specify a Name for Partition creation")
|
||||||
}
|
}
|
||||||
|
@ -62,7 +58,7 @@ func (p *Partitions) Create(ctx context.Context, partition *AdminPartition, q *W
|
||||||
}
|
}
|
||||||
|
|
||||||
wm := &WriteMeta{RequestTime: rtt}
|
wm := &WriteMeta{RequestTime: rtt}
|
||||||
var out AdminPartition
|
var out Partition
|
||||||
if err := decodeBody(resp, &out); err != nil {
|
if err := decodeBody(resp, &out); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -70,7 +66,7 @@ func (p *Partitions) Create(ctx context.Context, partition *AdminPartition, q *W
|
||||||
return &out, wm, nil
|
return &out, wm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Partitions) Update(ctx context.Context, partition *AdminPartition, q *WriteOptions) (*AdminPartition, *WriteMeta, error) {
|
func (p *Partitions) Update(ctx context.Context, partition *Partition, q *WriteOptions) (*Partition, *WriteMeta, error) {
|
||||||
if partition.Name == "" {
|
if partition.Name == "" {
|
||||||
return nil, nil, fmt.Errorf("Must specify a Name for Partition updating")
|
return nil, nil, fmt.Errorf("Must specify a Name for Partition updating")
|
||||||
}
|
}
|
||||||
|
@ -89,7 +85,7 @@ func (p *Partitions) Update(ctx context.Context, partition *AdminPartition, q *W
|
||||||
}
|
}
|
||||||
|
|
||||||
wm := &WriteMeta{RequestTime: rtt}
|
wm := &WriteMeta{RequestTime: rtt}
|
||||||
var out AdminPartition
|
var out Partition
|
||||||
if err := decodeBody(resp, &out); err != nil {
|
if err := decodeBody(resp, &out); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -97,8 +93,8 @@ func (p *Partitions) Update(ctx context.Context, partition *AdminPartition, q *W
|
||||||
return &out, wm, nil
|
return &out, wm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Partitions) Read(ctx context.Context, name string, q *QueryOptions) (*AdminPartition, *QueryMeta, error) {
|
func (p *Partitions) Read(ctx context.Context, name string, q *QueryOptions) (*Partition, *QueryMeta, error) {
|
||||||
var out AdminPartition
|
var out Partition
|
||||||
r := p.c.newRequest("GET", "/v1/partition/"+name)
|
r := p.c.newRequest("GET", "/v1/partition/"+name)
|
||||||
r.setQueryOptions(q)
|
r.setQueryOptions(q)
|
||||||
r.ctx = ctx
|
r.ctx = ctx
|
||||||
|
@ -143,8 +139,8 @@ func (p *Partitions) Delete(ctx context.Context, name string, q *WriteOptions) (
|
||||||
return wm, nil
|
return wm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Partitions) List(ctx context.Context, q *QueryOptions) (*AdminPartitions, *QueryMeta, error) {
|
func (p *Partitions) List(ctx context.Context, q *QueryOptions) ([]*Partition, *QueryMeta, error) {
|
||||||
var out *AdminPartitions
|
var out []*Partition
|
||||||
r := p.c.newRequest("GET", "/v1/partitions")
|
r := p.c.newRequest("GET", "/v1/partitions")
|
||||||
r.setQueryOptions(q)
|
r.setQueryOptions(q)
|
||||||
r.ctx = ctx
|
r.ctx = ctx
|
||||||
|
|
Loading…
Reference in New Issue