pureapi

package module
v0.0.0-...-4d52371 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

StorageAPI

This Library supports Pure Storage array

GoDoc Go Report Card

Usage

//main.go
package main

import "fmt"
import "github.com/vnikolin/pureapi"

func main() {
    client, err := NewStorageClient("192.168.1.115", "admin", "admin", "", "1.17")

	array, err := client.FetchArrayInfo()
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(array)
}

Documentation

Index

Constants

View Source
const (
	StatusUnauthorized        = "Unauthorized"
	StatusInternalServerError = "Server Error"
	StatusBadRequest          = "Bad Request"
	StatusConflict            = "Conflict Already Exists"
	StatusNotFound            = "Not Found"
	StatusForbidden           = "Forbidden"
)

Declaring the Constant Values

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayInfo

type ArrayInfo struct {
	Revision  string `json:"revision"`
	Version   string `json:"version"`
	ArrayName string `json:"array_name"`
	ID        string `json:"id"`
}

ArrayInfo

type Auth

type Auth struct {
	Token string `json:"api_token,omitempty"`
}

type DNSInfo

type DNSInfo struct {
	Domain      string   `json:"domain"`
	Nameservers []string `json:"nameservers"`
}

DNS

type HardwareInfo

type HardwareInfo struct {
	Details     interface{} `json:"details"`
	Identify    string      `json:"identify"`
	Index       int64       `json:"index"`
	Name        string      `json:"name"`
	Slot        int64       `json:"slot"`
	Speed       int64       `json:"speed"`
	Status      string      `json:"status"`
	Temperature int64       `json:"temperature"`
}

Hardware

type NTPServerInfo

type NTPServerInfo struct {
	Ntpserver []string `json:"ntpserver"`
}

NTPServerInfo

type NetworkInfo

type NetworkInfo struct {
	Address  string   `json:"address"`
	Enabled  bool     `json:"enabled"`
	Gateway  string   `json:"gateway"`
	Hwaddr   string   `json:"hwaddr"`
	Mtu      int64    `json:"mtu"`
	Name     string   `json:"name"`
	Netmask  string   `json:"netmask"`
	Services []string `json:"services"`
	Slaves   []string `json:"slaves"`
	Speed    int64    `json:"speed"`
	Subnet   string   `json:"subnet"`
}

Network

type PhoneHomeInfo

type PhoneHomeInfo struct {
	Phonehome string `json:"phonehome"`
}

PhoneHomeInfo

type SNMPInfo

type SNMPInfo struct {
	AuthPassphrase    interface{} `json:"auth_passphrase"`
	AuthProtocol      interface{} `json:"auth_protocol"`
	Community         interface{} `json:"community"`
	Host              string      `json:"host"`
	Name              string      `json:"name"`
	PrivacyPassphrase interface{} `json:"privacy_passphrase"`
	PrivacyProtocol   interface{} `json:"privacy_protocol"`
	User              interface{} `json:"user"`
	Version           string      `json:"version"`
}

SNMP

type StorageClient

type StorageClient struct {
	Hostname string
	Username string
	Password string
	APIToken string
	Version  string

	Client *http.Client
}

StorageClient ... Contstructor required Variables

func NewStorageClient

func NewStorageClient(target string, username string, password string, apiToken string,
	version string) (*StorageClient, error)

NewStorageClient ... Initializes the Constructor with the above variables

func (*StorageClient) FetchArrayInfo

func (c *StorageClient) FetchArrayInfo() (ArrayInfo, error)

FetchArrayInfo

func (*StorageClient) FetchDNSInfo

func (c *StorageClient) FetchDNSInfo() (DNSInfo, error)

FetchDNSInfo

func (*StorageClient) FetchHardwareInfo

func (c *StorageClient) FetchHardwareInfo() ([]HardwareInfo, error)

FetchHardwareInfo

func (*StorageClient) FetchNTPInfo

func (c *StorageClient) FetchNTPInfo() (NTPServerInfo, error)

FetchNTPInfo

func (*StorageClient) FetchNetworkInfo

func (c *StorageClient) FetchNetworkInfo() ([]NetworkInfo, error)

FetchNetworkInfo

func (*StorageClient) FetchPhoneHomeInfo

func (c *StorageClient) FetchPhoneHomeInfo() (PhoneHomeInfo, error)

FetchPhoneHomeInfo

func (*StorageClient) FetchSNMPInfo

func (c *StorageClient) FetchSNMPInfo() ([]SNMPInfo, error)

FetchSNMPInfo

func (*StorageClient) QueryData

func (c *StorageClient) QueryData(call string, link string, data []byte) ([]byte, http.Header, int, error)

queryData ... will make REST verbs based on the url

Jump to

Keyboard shortcuts

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