efsutil

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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

View Source
const CUSTOM_ATTRIBUTES int = -1

Variables

View Source
var ECCodecString = [...]string{"none", "xor", "rs", "cauchy"}

Functions

func AuthKey

func AuthKey(authkey string) string

func CacheAuthKey

func CacheAuthKey(cluster string, tenant string, user *User) string

func CacheUserKey

func CacheUserKey(cluster string, tenant string, user *User) string

func CheckService

func CheckService(svc string) bool

func CompletionAttribute

func CompletionAttribute(c unsafe.Pointer, name string) (string, error)

func DeleteUser

func DeleteUser(cluster string, tenant string, user *User) error

func GetBytes

func GetBytes(s string) (int64, error)

func GetFUNC

func GetFUNC(depthList ...int) string

func GetKeyValues

func GetKeyValues(cl string, tn string, bk string, obj string, pat string, max_len int, count int) (map[string]string, error)

func GetKeys

func GetKeys(cl string, tn string, bk string, obj string) ([]string, error)

func GetLibccowConf

func GetLibccowConf() ([]byte, error)

func GetMDKey

func GetMDKey(cl string, tn string, bk string, obj string, key string) (string, error)

func GetMDPat

func GetMDPat(cl string, tn string, bk string, obj string, pat string) (map[string]string, error)

func GetServerId

func GetServerId() ([]byte, error)

func HasCustomAttributes

func HasCustomAttributes(flags []FlagValue) bool

func InheritBucketAttributes

func InheritBucketAttributes(c unsafe.Pointer, bucket map[string]string) error

func IsSystemName

func IsSystemName(cl string) bool

func K8sServiceUp

func K8sServiceUp(sname string) error

Service calls this function after it is certain that it is up and running, so that we can update service metadata with dynamic info

func MatchUser

func MatchUser(cluster string, tenant string, user *User, password string) bool

func ModifyCustomAttributes

func ModifyCustomAttributes(cl string, tn string, bk string, obj string, flags []FlagValue) error

func ModifyDefaultAttributes

func ModifyDefaultAttributes(c unsafe.Pointer, flags []FlagValue) error

func PrintUser

func PrintUser(user *User)

func RandomString

func RandomString(size int) string

RandomString generates a random string for S3 key, secret auth

func ReadAttributes

func ReadAttributes(options map[string]string, flagNames []string, flags []FlagValue)

func SaveUser

func SaveUser(cluster string, tenant string, user *User) error

func UpdateMD

func UpdateMD(cl string, tn string, bk string, obj string, key string, value string) error

func UpdateMDMany

func UpdateMDMany(cl string, tn string, bk string, obj string, par []KeyValue) error

func UserKey

func UserKey(username string) string

func ValidateFlags

func ValidateFlags(flags []FlagValue) error

Types

type Address

type Address struct {
	IP        string           `json:"ip"`
	TargetRef *ObjectReference `json:"targetRef,omitempty"`
}

type ECMode

type ECMode struct {
	Data    int
	Parity  int
	DodecID int
}

func (*ECMode) Decode

func (m *ECMode) Decode(code int) error

func (*ECMode) DecodeString

func (m *ECMode) DecodeString(code string) error

func (*ECMode) Encode

func (m *ECMode) Encode() int

func (*ECMode) String

func (m *ECMode) String() string

type Endpoints

type Endpoints struct {
	Kind       string   `json:"kind"`
	ApiVersion string   `json:"apiVersion"`
	Metadata   Metadata `json:"metadata"`
	Subsets    []Subset `json:"subsets"`
}

type Event

type Event struct {
	Type   EventType `json:"type"`
	Object Endpoints `json:"object"`
}

Event represents a single event to a watched resource.

type EventType

type EventType string
const (
	Added    EventType = "ADDED"
	Modified EventType = "MODIFIED"
	Deleted  EventType = "DELETED"
	Error    EventType = "ERROR"
)

type FlagValue

type FlagValue struct {
	Name  string
	Value string
	Short string
	Def   string
	Desc  string
	Reg   string
	Ctype string
	Attr  int
}

type K8sClient

type K8sClient interface {
	Do(req *http.Request) (*http.Response, error)
	GetRequest(url string) (*http.Request, error)
	Host() string
	GetEndpoints(namespace, targetName string) (Endpoints, error)
}

K8sClient is minimal kubernetes client interface

func NewInClusterK8sClient

func NewInClusterK8sClient() (K8sClient, error)

NewInClusterK8sClient creates K8sClient if it is inside Kubernetes

func NewInsecureK8sClient

func NewInsecureK8sClient(apiURL string) K8sClient

NewInsecureK8sClient creates an insecure k8s client which is suitable to connect kubernetes api behind proxy

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

type Metadata

type Metadata struct {
	Name            string            `json:"name"`
	Namespace       string            `json:"namespace"`
	ResourceVersion string            `json:"resourceVersion"`
	Labels          map[string]string `json:"labels"`
}

type ObjectReference

type ObjectReference struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type Port

type Port struct {
	Name string `json:"name"`
	Port int    `json:"port"`
}

type Subset

type Subset struct {
	Addresses []Address `json:"addresses"`
	Ports     []Port    `json:"ports"`
}

type User

type User struct {
	Username string `json:"username"`
	Hash     string `json:"hash"`
	Type     string `json:"type"`
	Identity string `json:"identity"`
	Admin    int    `json:"admin"`

	// s3 authentication keys
	Authkey string `json:"authkey"`
	Secret  string `json:"secret"`
}

User - general user structure

func CreateUser

func CreateUser(cluster string, tenant string, username string, password string,
	usertype string, identity string, authkey string, secret string, admin int) *User

func ListUser

func ListUser(cluster string, tenant string, count int, name string) ([]*User, error)

func LoadUser

func LoadUser(cluster string, tenant string, key string) (*User, error)

Jump to

Keyboard shortcuts

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