@ -100,10 +100,25 @@ func (n *Namespaces) Update(ns *Namespace, q *WriteOptions) (*Namespace, *WriteM
func ( n * Namespaces ) Read ( name string , q * QueryOptions ) ( * Namespace , * QueryMeta , error ) {
var out Namespace
qm , err := n . c . query ( "/v1/namespace/" + name , & out , q )
r := n . c . newRequest ( "GET" , "/v1/namespace/" + name )
r . setQueryOptions ( q )
found , rtt , resp , err := requireNotFoundOrOK ( n . c . doRequest ( r ) )
if err != nil {
return nil , nil , err
}
defer resp . Body . Close ( )
qm := & QueryMeta { }
parseQueryMeta ( resp , qm )
qm . RequestTime = rtt
if ! found {
return nil , qm , nil
}
if err := decodeBody ( resp , & out ) ; err != nil {
return nil , nil , err
}
return & out , qm , nil
}
@ -122,10 +137,20 @@ func (n *Namespaces) Delete(name string, q *WriteOptions) (*WriteMeta, error) {
func ( n * Namespaces ) List ( q * QueryOptions ) ( [ ] * Namespace , * QueryMeta , error ) {
var out [ ] * Namespace
qm , err := n . c . query ( "/v1/namespaces" , & out , q )
r := n . c . newRequest ( "GET" , "/v1/namespaces" )
r . setQueryOptions ( q )
rtt , resp , err := requireOK ( n . c . doRequest ( r ) )
if err != nil {
return nil , nil , err
}
defer resp . Body . Close ( )
qm := & QueryMeta { }
parseQueryMeta ( resp , qm )
qm . RequestTime = rtt
if err := decodeBody ( resp , & out ) ; err != nil {
return nil , nil , err
}
return out , qm , nil
}