NewClusterAdminFromClient creates a new ClusterAdmin using the given client. Note that underlying client will also be closed on admin's Close() call.
(client Client)
| 226 | // NewClusterAdminFromClient creates a new ClusterAdmin using the given client. |
| 227 | // Note that underlying client will also be closed on admin's Close() call. |
| 228 | func NewClusterAdminFromClient(client Client) (ClusterAdmin, error) { |
| 229 | // make sure we can retrieve the controller |
| 230 | _, err := client.Controller() |
| 231 | if err != nil { |
| 232 | return nil, err |
| 233 | } |
| 234 | |
| 235 | ca := &clusterAdmin{ |
| 236 | client: client, |
| 237 | conf: client.Config(), |
| 238 | } |
| 239 | return ca, nil |
| 240 | } |
| 241 | |
| 242 | func (ca *clusterAdmin) Close() error { |
| 243 | return ca.client.Close() |