api

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2017 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Some of the code below came from https://github.com/digitalocean/ceph_exporter which has the same license.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatJsonResponse

func FormatJsonResponse(w http.ResponseWriter, object interface{})

Format a json response

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewEtcdHandler added in v0.3.0

func NewEtcdHandler(context *clusterd.Context) *etcdHandler

func Run added in v0.3.0

func Run(dcontext *clusterd.DaemonContext, config *Config) error

func ServeRoutes added in v0.3.0

func ServeRoutes(context *clusterd.Context, config *Config)

Types

type CephExporter added in v0.3.1

type CephExporter struct {
	// contains filtered or unexported fields
}

CephExporter wraps all the ceph collectors and provides a single global exporter to extracts metrics out of. It also ensures that the collection is done in a thread-safe manner, the necessary requirement stated by prometheus. It also implements a prometheus.Collector interface in order to register it correctly.

func NewCephExporter added in v0.3.1

func NewCephExporter(handler *Handler, conn ceph.Connection) *CephExporter

NewCephExporter creates an instance to CephExporter and returns a reference to it. We can choose to enable a collector to extract stats out of by adding it to the list of collectors.

func (*CephExporter) Collect added in v0.3.1

func (c *CephExporter) Collect(ch chan<- prometheus.Metric)

Collect sends the collected metrics from each of the collectors to prometheus. Collect could be called several times concurrently and thus its run is protected by a single mutex.

func (*CephExporter) Describe added in v0.3.1

func (c *CephExporter) Describe(ch chan<- *prometheus.Desc)

Describe sends all the descriptors of the collectors included to the provided channel.

type ClusterHandler added in v0.3.0

type ClusterHandler interface {
	GetClusterInfo() (*mon.ClusterInfo, error)
	EnableObjectStore() error
	RemoveObjectStore() error
	GetObjectStoreConnectionInfo() (s3info *model.ObjectStoreConnectInfo, found bool, err error)
	StartFileSystem(fs *model.FilesystemRequest) error
	RemoveFileSystem(fs *model.FilesystemRequest) error
	GetMonitors() (map[string]*mon.CephMonitorConfig, error)
	GetNodes() ([]model.Node, error)
}

type Config added in v0.3.0

type Config struct {
	Port        int
	ConnFactory mon.ConnectionFactory
	CephFactory ceph.ConnectionFactory
	ClusterInfo *mon.ClusterInfo
	ClusterHandler
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) CreateFileSystem added in v0.1.1

func (h *Handler) CreateFileSystem(w http.ResponseWriter, r *http.Request)

Creates a new file system in this cluster. POST /filesystem

func (*Handler) CreateImage

func (h *Handler) CreateImage(w http.ResponseWriter, r *http.Request)

Creates a new image in this cluster. POST /image

func (*Handler) CreateObjectStore added in v0.1.1

func (h *Handler) CreateObjectStore(w http.ResponseWriter, r *http.Request)

CreateObjectStore creates a new object store in this cluster. POST /objectstore

func (*Handler) CreatePool

func (h *Handler) CreatePool(w http.ResponseWriter, r *http.Request)

Creates a storage pool as specified by the request body. POST /pool

func (*Handler) CreateUser added in v0.3.0

func (h *Handler) CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser will create a new user from the passed info in the object store in this cluster. POST /objectstore/users

func (*Handler) DeleteImage added in v0.3.1

func (h *Handler) DeleteImage(w http.ResponseWriter, r *http.Request)

Deletes a block image from this cluster. DELETE /image?name=<imageName>&pool=<imagePool>

func (*Handler) DeleteUser added in v0.3.0

func (h *Handler) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser deletes the passed user for the object store in this cluster. DELETE /objectstore/users/{USER_ID}

func (*Handler) GetClientAccessInfo added in v0.1.1

func (h *Handler) GetClientAccessInfo(w http.ResponseWriter, r *http.Request)

Gets the information needed for a client to access the cluster. GET /client

func (*Handler) GetCrushMap

func (h *Handler) GetCrushMap(w http.ResponseWriter, r *http.Request)

Gets the current crush map for the cluster. GET /crushmap

func (*Handler) GetFileSystems added in v0.1.1

func (h *Handler) GetFileSystems(w http.ResponseWriter, r *http.Request)

Gets a listing of file systems in this cluster. GET /filesystem

func (*Handler) GetImages

func (h *Handler) GetImages(w http.ResponseWriter, r *http.Request)

Gets the images that have been created in this cluster. GET /image

func (*Handler) GetMonitors

func (h *Handler) GetMonitors(w http.ResponseWriter, r *http.Request)

Gets the monitors that have been created in this cluster. GET /mon

func (*Handler) GetNodes

func (h *Handler) GetNodes(w http.ResponseWriter, r *http.Request)

Gets the nodes that are part of this cluster. GET /node

func (*Handler) GetObjectStoreConnectionInfo added in v0.2.0

func (h *Handler) GetObjectStoreConnectionInfo(w http.ResponseWriter, r *http.Request)

GetObjectStoreConnectionInfo gets connection information to the object store in this cluster. GET /objectstore/connectioninfo

func (*Handler) GetPools

func (h *Handler) GetPools(w http.ResponseWriter, r *http.Request)

Gets the storage pools that have been created in this cluster. GET /pool

func (*Handler) GetRoutes

func (h *Handler) GetRoutes() []Route

func (*Handler) GetStatusDetails

func (h *Handler) GetStatusDetails(w http.ResponseWriter, r *http.Request)

Gets the status details of this cluster. GET /status

func (*Handler) GetUser added in v0.3.0

func (h *Handler) GetUser(w http.ResponseWriter, r *http.Request)

GetUser gets the passed users info from the object store in this cluster. GET /objectstore/users/{USER_ID}

func (*Handler) ListUsers added in v0.3.0

func (h *Handler) ListUsers(w http.ResponseWriter, r *http.Request)

ListUsers lists the users of the object store in this cluster. GET /objectstore/users

func (*Handler) Listbuckets added in v0.3.0

func (h *Handler) Listbuckets(w http.ResponseWriter, r *http.Request)

Listbuckets lists the buckets in the object store in this cluster. GET /objectstore/buckets

func (*Handler) RegisterMetrics added in v0.3.1

func (h *Handler) RegisterMetrics(retryMs int) error

RegisterMetrics registers all collected metrics by this API server. Note this should be called in a goroutine because it will retry upon failure and block until successful.

func (*Handler) RemoveFileSystem added in v0.1.1

func (h *Handler) RemoveFileSystem(w http.ResponseWriter, r *http.Request)

Removes an existing filesystem from this cluster. DELETE /filesystem?name=<fsName>

func (*Handler) RemoveObjectStore added in v0.1.1

func (h *Handler) RemoveObjectStore(w http.ResponseWriter, r *http.Request)

RemoveObjectStore removes the object store from this cluster. DELETE /objectstore

func (*Handler) SetLogLevel added in v0.1.1

func (h *Handler) SetLogLevel(w http.ResponseWriter, r *http.Request)

Sets the log level for this node. POST /log

func (*Handler) Shutdown added in v0.3.1

func (h *Handler) Shutdown()

func (*Handler) UpdateUser added in v0.3.0

func (h *Handler) UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser updates the passed user with the passed info for the object store in this cluster. PUT /objectstore/users/{USER_ID}

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL