efsutil

package
v0.0.0-...-ded4e1a 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: 22 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.

* 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 AppendStringToFile

func AppendStringToFile(fileName string, content string) error

func AskForConfirmation

func AskForConfirmation(s string) bool

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 CopyFile

func CopyFile(sourceFile string, destinationFile string) error

func CreateCcowdChannel

func CreateCcowdChannel(timeout_ms int) (*nnchannel, error)

Create IPC connection to ccow-daemon's REQ/REP channel

func CreateNanoMsgChannel

func CreateNanoMsgChannel(path string, rx_tmo_ms int) (*nnchannel, error)

Create a nanomessage NN_REQ connection to specified IPC address

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 GetFlexhashJson

func GetFlexhashJson() ([]byte, error)

func GetFolderContent

func GetFolderContent(path string) ([]os.FileInfo, error)

func GetIPv4Address

func GetIPv4Address(interfaceName string) (string, error)

func GetKeyValue

func GetKeyValue(cl string, tn string, bk string, obj string, key string, max_len int) (string, error)

func GetKeys

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

func GetLibccowConf

func GetLibccowConf() ([]byte, error)

func GetMD5HashInt32

func GetMD5HashInt32(str string) uint32

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 GetOndemandPolicyString

func GetOndemandPolicyString(cl string, tn string, bk string, obj 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 IsDirectory

func IsDirectory(path string) bool

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

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 ListUser

func ListUser(cluster string, tenant string, count int, name string) error

func LoadJsonFile

func LoadJsonFile(obj interface{}, fileName string) error

func LookupDNS

func LookupDNS(dnsname string) (string, error)

func MarshalToFile

func MarshalToFile(path string, data interface{}) error

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 ObjectCreate

func ObjectCreate(cl string, tn string, bk string, obj string) error

func ObjectDelete

func ObjectDelete(cl string, tn string, bk string, obj string) error

func ObjectExpunge

func ObjectExpunge(cl string, tn string, bk string, obj string) error

func PrintKeyStrValues

func PrintKeyStrValues(cl string, tn string, bk string, obj string, pat string, cmp int, max_len int, count int) (string, error)

func PrintKeyValues

func PrintKeyValues(cl string, tn string, bk string, obj string, pat string, cmp int, count int, extended bool) (string, error)

func PrintKeys

func PrintKeys(cl string, tn string, bk string, obj string, count int) error

func PrintMD

func PrintMD(cl string, tn string, bk string, obj string) error

func PrintMDCustom

func PrintMDCustom(cl string, tn string, bk string, obj string) error

func PrintMDPat

func PrintMDPat(cl string, tn string, bk string, obj string, pat string) 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(cmd *cobra.Command, flagNames []string, flags []FlagValue)

func ReplaceInFile

func ReplaceInFile(fileName string, pattern string, value string) error

func SaveUser

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

func SetKeyValueAttributes

func SetKeyValueAttributes(c unsafe.Pointer) 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

Types

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 FlagValue

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

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

func GetKeyValues

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

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 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