freenas

package
v0.0.0-...-521ba90 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Server   string
	Username string
	Password string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.

func (*BasicAuthTransport) Client

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent used when communicating with the FreeNAS API.
	UserAgent string

	Datasets  *DatasetService
	NfsShares *NfsShareService
	Users     *UserService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(server, user, password string) *Client

func (*Client) Debug

func (c *Client) Debug(enable bool)

Debug enables dumping http request objects to stdout

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

type Dataset

type Dataset struct {
	Name             string `json:"name"`
	Atime            string `json:"atime,omitempty"`
	Case_sensitivity string `json:"case_sensitivity,omitempty"`
	Comment          string `json:"comment,omitempty"`
	Compression      string `json:"compression,omitempty"`
	Dedup            string `json:"dedup,omitempty"`
	Readonly         string `json:"readonly,omitempty"`
	Quota            int64  `json:"quota,omitempty"`
	Recordsize       int64  `json:"recordsize,omitempty"`
	Refquota         int64  `json:"refquota,omitempty"`
	Refreservation   int64  `json:"refreservation,omitempty"`
	Reservation      int64  `json:"reservation,omitempty"`
}

type DatasetService

type DatasetService service

func (*DatasetService) Create

func (s *DatasetService) Create(ctx context.Context, parent string, dataset Dataset) (*Dataset, *Response, error)

Create a new dataset

func (*DatasetService) Delete

func (s *DatasetService) Delete(ctx context.Context, ds string) (*Response, error)

func (*DatasetService) Edit

func (s *DatasetService) Edit(ctx context.Context, parent string, dataset Dataset) (*Dataset, *Response, error)

func (*DatasetService) Get

func (s *DatasetService) Get(ctx context.Context, parent string) (*Dataset, *Response, error)

Get a single Dataset

func (*DatasetService) List

func (s *DatasetService) List(ctx context.Context) ([]*Dataset, *Response, error)

type ErrorResponse

type ErrorResponse struct{}

func (*ErrorResponse) Error

func (*ErrorResponse) Error() string

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	Offset int `url:"page,omitempty"`

	// For paginated result sets, the number of results to include per page.
	Limit int `url:"per_page,omitempty"`
}

type NfsShare

type NfsShare struct {
	ID           int64    `json:"id,omitempty"`
	Alldirs      bool     `json:"nfs_alldirs,omitempty"`
	Comment      string   `json:"nfs_comment,omitempty"`
	Hosts        string   `json:"nfs_hosts,omitempty"`
	MaprootGroup string   `json:"nfs_maproot_group,omitempty"`
	MaprootUser  string   `json:"nfs_maproot_user,omitempty"`
	MapallGroup  string   `json:"nfs_mapall_group,omitempty"`
	MapallUser   string   `json:"nfs_mapall_user,omitempty"`
	Network      string   `json:"nfs_network,omitempty"`
	Paths        []string `json:"nfs_paths,omitempty"`
	Quiet        bool     `json:"nfs_quiet,omitempty"`
	ReadOnly     bool     `json:"nfs_ro,omitempty"`
	Security     []string `json:"nfs_security"`
}

type NfsShareService

type NfsShareService service

func (*NfsShareService) Create

func (s *NfsShareService) Create(ctx context.Context, share NfsShare) (*NfsShare, *Response, error)

Create a new share

func (*NfsShareService) Delete

func (s *NfsShareService) Delete(ctx context.Context, number int64) (*Response, error)

func (*NfsShareService) Edit

func (s *NfsShareService) Edit(ctx context.Context, number int64, share NfsShare) (*NfsShare, *Response, error)

func (*NfsShareService) Get

func (s *NfsShareService) Get(ctx context.Context, number int64) (*NfsShare, *Response, error)

Get a single share

func (*NfsShareService) List

func (s *NfsShareService) List(ctx context.Context) ([]*NfsShare, *Response, error)

type Response

type Response struct {
	*http.Response
}

type User

type User struct {
	ID        int64  `json:"id,omitempty"`
	UID       int64  `json:"bsdusr_uid,omitempty"`
	Group     int64  `json:"bsdusr_group,omitempty"`
	Builtin   bool   `json:"bsdusr_builtin,omitempty"`
	Email     string `json:"bsdusr_email,omitempty"`
	Name      string `json:"bsdusr_full_name,omitempty"`
	Home      string `json:"bsdusr_home,omitempty"`
	Locked    bool   `json:"bsdusr_locked,omitempty"`
	Disabled  bool   `json:"bsdusr_password_disabled,omitempty"`
	Shell     string `json:"bsdusr_shell,omitempty"`
	Smbhash   string `json:"bsdusr_smbhash,omitempty"`
	Sshpubkey string `json:"bsdusr_sshpubkey,omitempty"`
	Unixhash  string `json:"bsdusr_unixhash,omitempty"`
	Username  string `json:"bsdusr_username,omitempty"`
	Sudo      bool   `json:"bsdusr_sudo,omitempty"`
}

type UserService

type UserService service

func (*UserService) Create

func (s *UserService) Create(ctx context.Context, user User) (*User, *Response, error)

Create a new user

func (*UserService) Delete

func (s *UserService) Delete(ctx context.Context, number int64) (*Response, error)

func (*UserService) Edit

func (s *UserService) Edit(ctx context.Context, number int64, user User) (*User, *Response, error)

func (*UserService) Get

func (s *UserService) Get(ctx context.Context, number int64) (*User, *Response, error)

Get a single User

func (*UserService) List

func (s *UserService) List(ctx context.Context) ([]*User, *Response, error)

Jump to

Keyboard shortcuts

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