webhdfs

package module
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 27 Imported by: 0

README

webhdfs

Examples

  • More examples can be found in client_test.go.
  • Write the file to HDFS and read the file back:
package main

import (
	"io/ioutil"
	"log"
	"strings"

	"github.com/aws/aws-sdk-go/aws"

	"github.com/searKing/webhdfs"
)

const (
	webHdfsEndpoint              = "quickstart.cloudera:50070"
	KerberosRealm                = "CLOUDERA"
	KerberosUsername             = "hdfs/quickstart.cloudera"
	KerberosServicePrincipleName = "HTTP/quickstart.cloudera"
	KerberosConfigFile           = "/etc/krb5.conf"
	// pick one auth way by 3 ways below, if all below are empty, kerberos is disabled.
	KerberosPassword   = ""
	KerberosKeyTabFile = "/hdfs.keytab"  // /krb5.keytab
	KerberosCCacheFile = "/tmp/krb5cc_0" // /tmp/krb5cc_0
)

func getClient() *webhdfs.Client {
	c, err := webhdfs.New(webHdfsEndpoint, webhdfs.WithDisableSSL(true),
		webhdfs.WithKerberosKeytabFile(KerberosUsername, KerberosServicePrincipleName, KerberosRealm, KerberosKeyTabFile, KerberosConfigFile))
	if err != nil {
		log.Fatalf("create client %s", err)
	}
	return c
}

func main() {
	file := "/data/test/sample.txt"
	{ // upload from hdfs
		resp, err := getClient().Create(&webhdfs.CreateRequest{
			Path:      aws.String(file),
			Body:      strings.NewReader("test_input"),
			Overwrite: aws.Bool(true),
		})
		if err != nil {
			log.Fatalf("webhdfs Open failed: %s", err)
		}
		defer resp.Body.Close()
	}

	{ // download from hdfs
		resp, err := getClient().Open(&webhdfs.OpenRequest{
			Path: aws.String(file),
		})
		if err != nil {
			t.Fatalf("webhdfs Open failed: %s", err)
		}
		defer resp.Body.Close()

		content, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			log.Fatalf("webhdfs Read failed: %s", err)
		}
		log.Printf("content: %s", string(content))

	}
}

TODO

  • Improve documentation
  • More examples

Documentation

Index

Constants

View Source
const (
	OpOpen                          = "OPEN"
	OpGetFileStatus                 = "GETFILESTATUS"
	OpListStatus                    = "LISTSTATUS"
	OpListStatusBatch               = "LISTSTATUS_BATCH"
	OpGetContentSummary             = "GETCONTENTSUMMARY"
	OpGetQuotaUsage                 = "GETQUOTAUSAGE"
	OpGetFileChecksum               = "GETFILECHECKSUM"
	OpGetHomeDirectory              = "GETHOMEDIRECTORY"
	OpGetDelegationToken            = "GETDELEGATIONTOKEN"
	OpGetTrashRoot                  = "GETTRASHROOT"
	OpGetXAttr                      = "GETXATTRS"
	OpGetXAttrs                     = "GETXATTRS"
	OpGetAllXAttrs                  = "GETXATTRS"
	OpListXAttrs                    = "LISTXATTRS"
	OpCheckAccess                   = "CHECKACCESS"
	OpGetAllStoragePolicy           = "GETALLSTORAGEPOLICY"
	OpGetStoragePolicy              = "GETSTORAGEPOLICY"
	OpGetSnapshotDiff               = "GETSNAPSHOTDIFF"
	OpGetSnapshottableDirectoryList = "GETSNAPSHOTTABLEDIRECTORYLIST"
	OpGetFileBlockLocations         = "GETFILEBLOCKLOCATIONS"
	OpGetECPolicy                   = "GETECPOLICY"
	OpCreate                        = "CREATE"
	OpMkdirs                        = "MKDIRS"
	OpCreateSymlink                 = "CREATESYMLINK"
	OpRename                        = "RENAME"
	OpSetReplication                = "SETREPLICATION"
	OpSetOwner                      = "SETOWNER"
	OpSetPermission                 = "SETPERMISSION"
	OpSetTimes                      = "SETTIMES"
	OpRenewDelegationToken          = "RENEWDELEGATIONTOKEN"
	OpCancelDelegationToken         = "CANCELDELEGATIONTOKEN"
	OpAllowSnapshot                 = "ALLOWSNAPSHOT"
	OpDisallowSnapshot              = "DISALLOWSNAPSHOT"
	OpCreateSnapshot                = "CREATESNAPSHOT"
	OpRenameSnapshot                = "RENAMESNAPSHOT"
	OpSetXAttr                      = "SETXATTR"
	OpRemoveXAttr                   = "REMOVEXATTR"
	OpSetStoragePolicy              = "SETSTORAGEPOLICY"
	OpSatisfyStoragePolicy          = "SATISFYSTORAGEPOLICY"
	OpEnableECPolicy                = "ENABLEECPOLICY"
	OpDisableECPolicy               = "DISABLEECPOLICY"
	OpSetECPolicy                   = "SETECPOLICY"
	OpAppend                        = "APPEND"
	OpConcat                        = "CONCAT"
	OpTruncate                      = "TRUNCATE"
	OpUnsetStoragePolicy            = "UNSETSTORAGEPOLICY"
	OpUnsetECPolicy                 = "UNSETECPOLICY"
	OpDelete                        = "DELETE"
	OpDeleteSnapshot                = "DELETESNAPSHOT"
)
View Source
const (
	HttpQueryParamKeyXAttrName          = "xattr.name"
	HttpQueryParamKeyXAttrValueEncoding = "encoding"
)

HTTP Query Parameter Dictionary

View Source
const (
	JavaClassNameFileNotFoundException            = "java.io.FileNotFoundException"
	JavaClassNameAccessControlException           = "org.apache.hadoop.security.AccessControlException"
	JavaClassNamePathIsNotEmptyDirectoryException = "org.apache.hadoop.fs.PathIsNotEmptyDirectoryException"
	JavaClassNameFileAlreadyExistsException       = "org.apache.hadoop.fs.FileAlreadyExistsException"
	JavaClassNameAlreadyBeingCreatedException     = "org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException"
)
View Source
const (
	PathPrefix = "/webhdfs/v1/"
)

Variables

View Source
var (
	MaxHTTPBodyLengthDumped = 100
)

Functions

func ErrorFromHttpResponse added in v0.0.8

func ErrorFromHttpResponse(resp *http.Response) error

func IsAccessControlException

func IsAccessControlException(err error) bool

func IsFileNotFoundException

func IsFileNotFoundException(err error) bool

func IsIllegalArgumentException

func IsIllegalArgumentException(err error) bool

func IsSecurityException

func IsSecurityException(err error) bool

func XAttrNamespaceSliceContains

func XAttrNamespaceSliceContains(enums []XAttrNamespace, sunEnums ...XAttrNamespace) bool

XAttrNamespaceSliceContains reports whether sunEnums is within enums.

func XAttrNamespaceSliceContainsAny

func XAttrNamespaceSliceContainsAny(enums []XAttrNamespace, sunEnums ...XAttrNamespace) bool

XAttrNamespaceSliceContainsAny reports whether any sunEnum is within enums.

Types

type AllowSnapshotRequest

type AllowSnapshotRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*AllowSnapshotRequest) RawPath

func (req *AllowSnapshotRequest) RawPath() string

func (*AllowSnapshotRequest) RawQuery

func (req *AllowSnapshotRequest) RawQuery() string

type AllowSnapshotResponse

type AllowSnapshotResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*AllowSnapshotResponse) UnmarshalHTTP

func (resp *AllowSnapshotResponse) UnmarshalHTTP(httpResp *http.Response) error

type AppendRequest

type AppendRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Object data.
	Body io.Reader
	// ContentLength records the length of the associated content.
	// The value -1 indicates that the length is unknown.
	// Values >= 0 indicate that the given number of bytes may
	// be read from Body.
	//
	// For client requests, a value of 0 with a non-nil Body is
	// also treated as unknown.
	// For HttpFs, ContentType and ContentLength is needed with a non-nil Body
	// ContentLength will be computed inner when Body is one of type [*bytes.Buffer, *bytes.Reader, *strings.Reader]
	// See https://issues.cloudera.org/browse/HUE-679
	// Missing or unknown request method
	// Missing URL
	// Missing HTTP Identifier (HTTP/1.0)
	// Request is too large
	// Content-Length missing for POST or PUT requests
	// Illegal character in hostname; underscores are not allowed
	ContentLength *int64

	// Name				buffersize
	// Description		The size of the buffer used in transferring data.
	// Type				int
	// Default Value	Specified in the configuration.
	// Valid Values		> 0
	// Syntax			Any integer.
	BufferSize *int
	// Name				nodirect
	// Description		Disable automatically redirected.
	// Type				bool
	// Default Value	false
	// Valid Values		true|false
	// Syntax			Any Bool.
	NoDirect *bool
}

func (*AppendRequest) RawPath

func (req *AppendRequest) RawPath() string

func (*AppendRequest) RawQuery

func (req *AppendRequest) RawQuery() string

type AppendResponse

type AppendResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	NoDirect bool    `json:"-"`
	Location *string `json:"Location"`
}

func (*AppendResponse) UnmarshalHTTP

func (resp *AppendResponse) UnmarshalHTTP(httpResp *http.Response) error

type Authentication

type Authentication struct {
	// Delegation
	// Name				delegation
	// Description		The delegation token used for authentication.
	// Type				String
	// Default Value	<empty>
	// Valid Values		An encoded token.
	// Syntax		See the note below.
	// Note that delegation tokens are encoded as a URL safe string;
	// see encodeToUrlString() and decodeFromUrlString(String) in org.apache.hadoop.security.token.Token for the details of the encoding.
	Delegation *string
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Authentication When security is off, the authenticated user is the username specified in the user.name query parameter. If the user.name parameter is not set, the server may either set the authenticated user to a default web user, if there is any, or return an error response. When security is on, authentication is performed by either Hadoop delegation token or Kerberos SPNEGO. If a token is set in the delegation query parameter, the authenticated user is the user encoded in the token. If the delegation parameter is not set, the user is authenticated by Kerberos SPNEGO. Below are examples using the curl command tool. Authentication when security is off:

curl -i "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?[user.name=<USER>&]op=..."

Authentication using Kerberos SPNEGO when security is on:

curl -i --negotiate -u : "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=..."

Authentication using Hadoop delegation token when security is on:

curl -i "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?delegation=<TOKEN>&op=..."

See also: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/HttpAuthentication.html

type BlockLocationProperties

type BlockLocationProperties struct {
	CachedHosts   []string      `json:"cachedHosts" validate:"required"`   // Datanode hostnames with a cached replica
	Corrupt       bool          `json:"corrupt" validate:"required"`       // True if the block is corrupted
	Hosts         []string      `json:"hosts" validate:"required"`         // Datanode hostnames store the block
	Length        int64         `json:"length" validate:"required"`        // Length of the block
	Names         []string      `json:"names" validate:"required"`         // Datanode IP:xferPort for accessing the block
	Offset        int64         `json:"offset" validate:"required"`        // Offset of the block in the file
	StorageTypes  []StorageType `json:"storageTypes" validate:"required"`  // Storage type of each replica, ["RAM_DISK", "SSD", "DISK", "ARCHIVE"]
	TopologyPaths []string      `json:"topologyPaths" validate:"required"` // Datanode addresses in network topology, [ /rack/host:ip ]
}

JavaScript syntax is used to define blockLocationProperties so that it can be referred in both BlockLocation and BlockLocations JSON schemas. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#BlockLocation_Properties

type BlockLocations

type BlockLocations = struct {
	BlockLocations []BlockLocation `json:"BlockLocation"` // An array of BlockLocation
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#BlockLocations_JSON_Schema

type BlockStoragePolicies

type BlockStoragePolicies struct {
	BlockStoragePolicies []BlockStoragePolicyProperties `json:"BlockStoragePolicy" validate:"required"` // An array of BlockStoragePolicy.
}

See:https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#BlockStoragePolicies_JSON_Schema

type BlockStoragePolicy

type BlockStoragePolicy struct {
	BlockStoragePolicy BlockStoragePolicyProperties `json:"BlockStoragePolicy" validate:"required"` // An BlockStoragePolicy.
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#BlockStoragePolicy_JSON_Schema

type BlockStoragePolicyProperties

type BlockStoragePolicyProperties struct {
	Id                   int64    `json:"id" validate:"required"`                   // Policy ID.
	Name                 string   `json:"name" validate:"required"`                 // Policy Name.
	StorageTypes         []string `json:"storageTypes" validate:"required"`         // An array of storage types for block placement.
	ReplicationFallbacks []string `json:"replicationFallbacks" validate:"required"` // An array of fallback storage types for replication.
	CreationFallbacks    []string `json:"creationFallbacks" validate:"required"`    // An array of fallback storage types for file creation.
	CopyOnCreate         bool     `json:"copyOnCreateFile" validate:"required"`     // If set then the policy cannot be changed after file creation.
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#BlockStoragePolicy_Properties

type CSRF

type CSRF struct {
	// Name				X-XSRF-HEADER
	// Description		The name of a custom header that HTTP requests must send when protection against cross-site request forgery (CSRF) is enabled for WebHDFS by setting dfs.webhdfs.rest-csrf.enabled to true.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid username.
	// Syntax			Any string.
	XXsrfHeader *string
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Cross-Site_Request_Forgery_Prevention

type CancelDelegationTokenRequest

type CancelDelegationTokenRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				token
	// Description		The delegation token used for the operation.
	// Type				String
	// Default Value	<empty>
	// Valid Values		An encoded token.
	// Syntax			See the note in Delegation.
	Token *string `json:"token,omitempty"`
}

func (*CancelDelegationTokenRequest) RawPath

func (req *CancelDelegationTokenRequest) RawPath() string

func (*CancelDelegationTokenRequest) RawQuery

func (req *CancelDelegationTokenRequest) RawQuery() string

type CancelDelegationTokenResponse

type CancelDelegationTokenResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*CancelDelegationTokenResponse) UnmarshalHTTP

func (resp *CancelDelegationTokenResponse) UnmarshalHTTP(httpResp *http.Response) error

type CheckAccessRequest

type CheckAccessRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Fs Action
	// Name				fsaction
	// Description		File system operation read/write/execute
	// Type				String
	// Default Value	null (an invalid value)
	// Valid Values		Strings matching regex pattern  "[r-][w-][x-] "
	// Syntax		 	"[r-][w-][x-] "
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Fs_Action
	Fsaction *string `validate:"required"`
}

func (*CheckAccessRequest) RawPath

func (req *CheckAccessRequest) RawPath() string

func (*CheckAccessRequest) RawQuery

func (req *CheckAccessRequest) RawQuery() string

type CheckAccessResponse

type CheckAccessResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*CheckAccessResponse) UnmarshalHTTP

func (resp *CheckAccessResponse) UnmarshalHTTP(httpResp *http.Response) error

type Client

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

func New

func New(endpoint string, opts ...ClientOption) (*Client, error)

func (*Client) AllowSnapshotWithContext added in v0.0.2

func (c *Client) AllowSnapshotWithContext(ctx context.Context, req *AllowSnapshotRequest) (*AllowSnapshotResponse, error)

func (*Client) AppendWithContext added in v0.0.2

func (c *Client) AppendWithContext(ctx context.Context, req *AppendRequest) (*AppendResponse, error)

func (*Client) ApplyOptions

func (o *Client) ApplyOptions(options ...ClientOption) *Client

func (*Client) CancelDelegationTokenWithContext added in v0.0.2

func (c *Client) CancelDelegationTokenWithContext(ctx context.Context, req *CancelDelegationTokenRequest) (*CancelDelegationTokenResponse, error)

func (*Client) CheckAccessWithContext added in v0.0.2

func (c *Client) CheckAccessWithContext(ctx context.Context, req *CheckAccessRequest) (*CheckAccessResponse, error)

func (*Client) Concat

func (c *Client) Concat(req *ConcatRequest) (*ConcatResponse, error)

Concat File(s) See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Concat_File(s) Also see: https://issues.apache.org/jira/browse/HDFS-6641 the pre-conditions of HDFS concat right now are:

All source files must be in the same directory. Replication and block size must be the same for all source files. All blocks must be full in all source files except the last source file. In the last source file, all blocks must be full except the last block.

func (*Client) ConcatWithContext added in v0.0.2

func (c *Client) ConcatWithContext(ctx context.Context, req *ConcatRequest) (*ConcatResponse, error)

func (*Client) Create

func (c *Client) Create(req *CreateRequest) (*CreateResponse, error)

Create and Write to a File If no permissions are specified, the newly created file will be assigned with default 644 permission. No umask mode will be applied from server side (so “fs.permissions.umask-mode” value configuration set on Namenode side will have no effect). Parent Dirs will be created automatically. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Create_and_Write_to_a_File

func (*Client) CreateSnapshotWithContext added in v0.0.2

func (c *Client) CreateSnapshotWithContext(ctx context.Context, req *CreateSnapshotRequest) (*CreateSnapshotResponse, error)

func (*Client) CreateSymlinkWithContext added in v0.0.2

func (c *Client) CreateSymlinkWithContext(ctx context.Context, req *CreateSymlinkRequest) (*CreateSymlinkResponse, error)

func (*Client) CreateWithContext added in v0.0.2

func (c *Client) CreateWithContext(ctx context.Context, req *CreateRequest) (*CreateResponse, error)

func (*Client) DeleteSnapshotWithContext added in v0.0.2

func (c *Client) DeleteSnapshotWithContext(ctx context.Context, req *DeleteSnapshotRequest) (*DeleteSnapshotResponse, error)

func (*Client) DeleteWithContext added in v0.0.2

func (c *Client) DeleteWithContext(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error)

func (*Client) DisableECPolicyWithContext added in v0.0.2

func (c *Client) DisableECPolicyWithContext(ctx context.Context, req *DisableECPolicyRequest) (*DisableECPolicyResponse, error)

func (*Client) DisallowSnapshotWithContext added in v0.0.2

func (c *Client) DisallowSnapshotWithContext(ctx context.Context, req *DisallowSnapshotRequest) (*DisallowSnapshotResponse, error)

func (*Client) EnableECPolicyWithContext added in v0.0.2

func (c *Client) EnableECPolicyWithContext(ctx context.Context, req *EnableECPolicyRequest) (*EnableECPolicyResponse, error)

func (*Client) GetAllStoragePolicyWithContext added in v0.0.2

func (c *Client) GetAllStoragePolicyWithContext(ctx context.Context, req *GetAllStoragePolicyRequest) (*GetAllStoragePolicyResponse, error)

func (*Client) GetAllXAttrsWithContext added in v0.0.2

func (c *Client) GetAllXAttrsWithContext(ctx context.Context, req *GetAllXAttrsRequest) (*GetAllXAttrsResponse, error)

func (*Client) GetContentSummaryWithContext added in v0.0.2

func (c *Client) GetContentSummaryWithContext(ctx context.Context, req *GetContentSummaryRequest) (*GetContentSummaryResponse, error)

func (*Client) GetDelegationTokenWithContext added in v0.0.2

func (c *Client) GetDelegationTokenWithContext(ctx context.Context, req *GetDelegationTokenRequest) (*GetDelegationTokenResponse, error)

func (*Client) GetECPolicyWithContext added in v0.0.2

func (c *Client) GetECPolicyWithContext(ctx context.Context, req *GetECPolicyRequest) (*GetECPolicyResponse, error)

func (*Client) GetFileBlockLocationsWithContext added in v0.0.2

func (c *Client) GetFileBlockLocationsWithContext(ctx context.Context, req *GetFileBlockLocationsRequest) (*GetFileBlockLocationsResponse, error)

func (*Client) GetFileChecksumWithContext added in v0.0.2

func (c *Client) GetFileChecksumWithContext(ctx context.Context, req *GetFileChecksumRequest) (*GetFileChecksumResponse, error)

func (*Client) GetFileStatusWithContext added in v0.0.2

func (c *Client) GetFileStatusWithContext(ctx context.Context, req *GetFileStatusRequest) (*GetFileStatusResponse, error)

func (*Client) GetHomeDirectoryWithContext added in v0.0.2

func (c *Client) GetHomeDirectoryWithContext(ctx context.Context, req *GetHomeDirectoryRequest) (*GetHomeDirectoryResponse, error)

func (*Client) GetQuotaUsageWithContext added in v0.0.2

func (c *Client) GetQuotaUsageWithContext(ctx context.Context, req *GetQuotaUsageRequest) (*GetQuotaUsageResponse, error)

func (*Client) GetSnapshotDiffWithContext added in v0.0.2

func (c *Client) GetSnapshotDiffWithContext(ctx context.Context, req *GetSnapshotDiffRequest) (*GetSnapshotDiffResponse, error)

func (*Client) GetSnapshottableDirectoryList

Get Snapshottable Directory List If the USER is not the hdfs super user, the call lists only the snapshottable directories owned by the user. If the USER is the hdfs super user, the call lists all the snapshottable directories. See also: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Get_Snapshottable_Directory_List

func (*Client) GetSnapshottableDirectoryListWithContext added in v0.0.2

func (c *Client) GetSnapshottableDirectoryListWithContext(ctx context.Context, req *GetSnapshottableDirectoryListRequest) (*GetSnapshottableDirectoryListResponse, error)

func (*Client) GetStoragePolicyWithContext added in v0.0.2

func (c *Client) GetStoragePolicyWithContext(ctx context.Context, req *GetStoragePolicyRequest) (*GetStoragePolicyResponse, error)

func (*Client) GetTrashRootWithContext added in v0.0.2

func (c *Client) GetTrashRootWithContext(ctx context.Context, req *GetTrashRootRequest) (*GetTrashRootResponse, error)

func (*Client) GetXAttrWithContext added in v0.0.2

func (c *Client) GetXAttrWithContext(ctx context.Context, req *GetXAttrRequest) (*GetXAttrResponse, error)

func (*Client) GetXAttrsWithContext added in v0.0.2

func (c *Client) GetXAttrsWithContext(ctx context.Context, req *GetXAttrsRequest) (*GetXAttrsResponse, error)

func (*Client) HttpSchema

func (c *Client) HttpSchema() string

func (*Client) HttpUrl

func (c *Client) HttpUrl(query Request) url.URL

func (*Client) ListStatusBatch

func (c *Client) ListStatusBatch(req *ListStatusBatchRequest) (*ListStatusBatchResponse, error)

Iteratively List a Directory https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Iteratively_List_a_Directory If remainingEntries is non-zero, there are additional entries in the directory. To query the next batch, set the startAfter parameter to the pathSuffix of the last item returned in the current batch. Batch size is controlled by the dfs.ls.limit option on the NameNode.

func (*Client) ListStatusBatchWithContext added in v0.0.2

func (c *Client) ListStatusBatchWithContext(ctx context.Context, req *ListStatusBatchRequest) (*ListStatusBatchResponse, error)

func (*Client) ListStatusWithContext added in v0.0.2

func (c *Client) ListStatusWithContext(ctx context.Context, req *ListStatusRequest) (*ListStatusResponse, error)

func (*Client) ListXAttrsWithContext added in v0.0.2

func (c *Client) ListXAttrsWithContext(ctx context.Context, req *ListXAttrsRequest) (*ListXAttrsResponse, error)

func (*Client) Mkdirs

func (c *Client) Mkdirs(req *MkdirsRequest) (*MkdirsResponse, error)

Make a Directory If no permissions are specified, the newly created directory will have 755 permission as default. No umask mode will be applied from server side (so “fs.permissions.umask-mode” value configuration set on Namenode side will have no effect). See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Make_a_Directory

func (*Client) MkdirsWithContext added in v0.0.2

func (c *Client) MkdirsWithContext(ctx context.Context, req *MkdirsRequest) (*MkdirsResponse, error)

func (*Client) OpenWithContext added in v0.0.2

func (c *Client) OpenWithContext(ctx context.Context, req *OpenRequest) (*OpenResponse, error)

func (*Client) ProxyUser added in v0.0.8

func (c *Client) ProxyUser() ProxyUser

ProxyUser returns the authenticated user, may be needed as 'user.name' to authenticate See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Authentication

func (*Client) RemoveXAttrWithContext added in v0.0.2

func (c *Client) RemoveXAttrWithContext(ctx context.Context, req *RemoveXAttrRequest) (*RemoveXAttrResponse, error)

func (*Client) RenameSnapshotWithContext added in v0.0.2

func (c *Client) RenameSnapshotWithContext(ctx context.Context, req *RenameSnapshotRequest) (*RenameSnapshotResponse, error)

func (*Client) RenameWithContext added in v0.0.2

func (c *Client) RenameWithContext(ctx context.Context, req *RenameRequest) (*RenameResponse, error)

func (*Client) RenewDelegationTokenWithContext added in v0.0.2

func (c *Client) RenewDelegationTokenWithContext(ctx context.Context, req *RenewDelegationTokenRequest) (*RenewDelegationTokenResponse, error)

func (*Client) SatisfyStoragePolicyWithContext added in v0.0.2

func (c *Client) SatisfyStoragePolicyWithContext(ctx context.Context, req *SatisfyStoragePolicyRequest) (*SatisfyStoragePolicyResponse, error)

func (*Client) SetECPolicyWithContext added in v0.0.2

func (c *Client) SetECPolicyWithContext(ctx context.Context, req *SetECPolicyRequest) (*SetECPolicyResponse, error)

func (*Client) SetOwnerWithContext added in v0.0.2

func (c *Client) SetOwnerWithContext(ctx context.Context, req *SetOwnerRequest) (*SetOwnerResponse, error)

func (*Client) SetPermissionWithContext added in v0.0.2

func (c *Client) SetPermissionWithContext(ctx context.Context, req *SetPermissionRequest) (*SetPermissionResponse, error)

func (*Client) SetReplicationWithContext added in v0.0.2

func (c *Client) SetReplicationWithContext(ctx context.Context, req *SetReplicationRequest) (*SetReplicationResponse, error)

func (*Client) SetStoragePolicyWithContext added in v0.0.2

func (c *Client) SetStoragePolicyWithContext(ctx context.Context, req *SetStoragePolicyRequest) (*SetStoragePolicyResponse, error)

func (*Client) SetTimesWithContext added in v0.0.2

func (c *Client) SetTimesWithContext(ctx context.Context, req *SetTimesRequest) (*SetTimesResponse, error)

func (*Client) SetXAttrWithContext added in v0.0.2

func (c *Client) SetXAttrWithContext(ctx context.Context, req *SetXAttrRequest) (*SetXAttrResponse, error)

func (*Client) TruncateWithContext added in v0.0.2

func (c *Client) TruncateWithContext(ctx context.Context, req *TruncateRequest) (*TruncateResponse, error)

func (*Client) UnsetECPolicyWithContext added in v0.0.2

func (c *Client) UnsetECPolicyWithContext(ctx context.Context, req *UnsetECPolicyRequest) (*UnsetECPolicyResponse, error)

func (*Client) UnsetStoragePolicyWithContext added in v0.0.2

func (c *Client) UnsetStoragePolicyWithContext(ctx context.Context, req *UnsetStoragePolicyRequest) (*UnsetStoragePolicyResponse, error)

func (*Client) UrlString

func (c *Client) UrlString(addr string, req Request) (string, error)

addr is a valid namenode

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

A ClientOption sets options.

func WithDisableSSL

func WithDisableSSL(disableSSL bool) ClientOption

func WithHttpClient

func WithHttpClient(httpCli *http.Client) ClientOption

func WithKerberosCCache

func WithKerberosCCache(username string, spn string, realm string, cc string, krb5Con string) ClientOption

func WithKerberosCCacheFile

func WithKerberosCCacheFile(username string, spn string, realm string, ccFile string, krb5ConFile string) ClientOption

func WithKerberosConfig added in v0.0.2

func WithKerberosConfig(kerberosConfig *kerberos.Config) ClientOption

func WithKerberosKeytab

func WithKerberosKeytab(username string, spn string, realm string, keytab string, krb5Con string) ClientOption

func WithKerberosKeytabFile

func WithKerberosKeytabFile(username string, spn string, realm string, keytabFile string, krb5ConFile string) ClientOption

func WithKerberosPassword

func WithKerberosPassword(username string, spn string, realm string, password string, krb5Con string) ClientOption

func WithValidator

func WithValidator(v *validator.Validate) ClientOption

type ClientOptionFunc

type ClientOptionFunc func(*Client)

ClientOptionFunc wraps a function that modifies Client into an implementation of the ClientOption interface.

type CompletedConfig

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

func (CompletedConfig) New

func (c CompletedConfig) New() (*Client, error)

New creates a new server which logically combines the handling chain with the passed server. The handler chain in particular can be difficult as it starts delgating. New usually called after Complete

func (CompletedConfig) Validate added in v0.0.13

func (o CompletedConfig) Validate() error

Validate checks Config.

type ConcatRequest

type ConcatRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				sources
	// Description		A list of source paths.
	// Type				String
	// Default Value	<empty>
	// Valid Values		A list of comma seperated absolute FileSystem paths without scheme and authority.
	// Syntax			Any string.
	Sources *string
}

func (*ConcatRequest) RawPath

func (req *ConcatRequest) RawPath() string

func (*ConcatRequest) RawQuery

func (req *ConcatRequest) RawQuery() string

type ConcatResponse

type ConcatResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*ConcatResponse) UnmarshalHTTP

func (resp *ConcatResponse) UnmarshalHTTP(httpResp *http.Response) error

type Config

type Config struct {
	// Addresses specifies the namenode(s) to connect to.
	Addresses []string `validate:"required"`

	// The authenticated user
	Username *string

	// Set this to `true` to disable SSL when sending requests. Defaults
	// to `false`.
	DisableSSL bool

	HttpConfig *http_.Config `validate:"dive"`

	Validator *validator.Validate
}

Config Code borrowed from https://github.com/kubernetes/kubernetes call chains: NewConfig -> Complete -> [Validate] -> New|Apply

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values

func (*Config) Complete

func (o *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to ApplyOptions, do that first. It's mutating the receiver.

type ContentSummary

type ContentSummary struct {
	// If Path is a File, then DirectoryCount == 0
	// If Path is a Directory, then the Path is included as '.', DirectoryCount == len(subdirs) + 1(.)
	DirectoryCount int64 `json:"directoryCount" validate:"required"` // The number of directories.
	FileCount      int64 `json:"fileCount" validate:"required"`      // The number of files.
	// Length is the total size of the named path, including any subdirectories.
	Length int64 `json:"length" validate:"required"` // The number of bytes used by the content.
	Quota  int64 `json:"quota" validate:"required"`  // The namespace quota of this directory.
	// SpaceConsumed is the total size of the named path, including any
	// subdirectories. Unlike Length, it counts the total replicated size of each
	// file, and represents the total on-disk footprint64 for a tree in HDFS.
	SpaceConsumed int64     `json:"spaceConsumed" validate:"required"` // The disk space consumed by the content.
	SpaceQuota    int64     `json:"spaceQuota" validate:"required"`    // The disk space quota.
	TypeQuota     TypeQuota `json:"typeQuota" validate:"required"`
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#ContentSummary_JSON_Schema

type CreateRequest

type CreateRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Object data.
	Body io.Reader
	// ContentLength records the length of the associated content.
	// The value -1 indicates that the length is unknown.
	// Values >= 0 indicate that the given number of bytes may
	// be read from Body.
	//
	// For client requests, a value of 0 with a non-nil Body is
	// also treated as unknown.
	// For HttpFs, ContentType and ContentLength is needed with a non-nil Body
	// ContentLength will be computed inner when Body is one of type [*bytes.Buffer, *bytes.Reader, *strings.Reader]
	// See https://issues.cloudera.org/browse/HUE-679
	// Missing or unknown request method
	// Missing URL
	// Missing HTTP Identifier (HTTP/1.0)
	// Request is too large
	// Content-Length missing for POST or PUT requests
	// Illegal character in hostname; underscores are not allowed
	ContentLength *int64

	// Name				overwrite
	// Description		If a file already exists, should it be overwritten?
	// Type				boolean
	// Default Value	false
	// Valid Values		true
	// Syntax			true
	// Actually, HttpFS default to true
	Overwrite *bool
	// Name				blocksize
	// Description		The block size of a file.
	// Type				long
	// Default Value	Specified in the configuration.
	// Valid Values		> 0
	// Syntax			Any integer.
	Blocksize *int64
	// Name				replication
	// Description		The number of replications of a file.
	// Type				short
	// Default Value	Specified in the configuration.
	// Valid Values		> 0
	// Syntax			Any integer.
	Replication *int
	// Name	permission
	// Description		The permission of a file/directory.
	// Type	Octal
	// Default Value	644 for files, 755 for directories
	// Valid Values		0 - 1777
	// Syntax			Any radix-8 integer (leading zeros may be omitted.)
	Permission *int
	// Name				buffersize
	// Description		The size of the buffer used in transferring data.
	// Type				int
	// Default Value	Specified in the configuration.
	// Valid Values		> 0
	// Syntax			Any integer.
	BufferSize *int
	// Name				nodirect
	// Description		Disable automatically redirected.
	// Type				bool
	// Default Value	false
	// Valid Values		true|false
	// Syntax			Any Bool.
	NoDirect *bool
}

func (*CreateRequest) RawPath

func (req *CreateRequest) RawPath() string

func (*CreateRequest) RawQuery

func (req *CreateRequest) RawQuery() string

type CreateResponse

type CreateResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	NoDirect bool    `json:"-"`
	Location *string `json:"Location"`
}

func (*CreateResponse) UnmarshalHTTP

func (resp *CreateResponse) UnmarshalHTTP(httpResp *http.Response) error

type CreateSnapshotRequest

type CreateSnapshotRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
	// Name				snapshotname
	// Description		The name of the snapshot to be created/deleted. Or the new name for snapshot rename.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Snapshot_Name
	Snapshotname *string `json:"snapshotname,omitempty"`
}

func (*CreateSnapshotRequest) RawPath

func (req *CreateSnapshotRequest) RawPath() string

func (*CreateSnapshotRequest) RawQuery

func (req *CreateSnapshotRequest) RawQuery() string

type CreateSnapshotResponse

type CreateSnapshotResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	// Path of the object to get.
	//
	// Path is a required field
	Path *string
}

func (*CreateSnapshotResponse) UnmarshalHTTP

func (resp *CreateSnapshotResponse) UnmarshalHTTP(httpResp *http.Response) error

type CreateSymlinkRequest

type CreateSymlinkRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				destination
	// Description		The destination path.
	// Type				Path
	// Default Value	<empty> (an invalid path)
	// Valid Values		An absolute FileSystem path without scheme and authority.
	// Syntax			Any path.
	Destination *string `validate:"required"`

	// Name				createparent
	// Description		If the parent directories do not exist, should they be created?
	// Type				boolean
	// Default Value	true
	// Valid Values		true, false
	// Syntax			true
	CreateParent *bool
}

func (*CreateSymlinkRequest) RawPath

func (req *CreateSymlinkRequest) RawPath() string

func (*CreateSymlinkRequest) RawQuery

func (req *CreateSymlinkRequest) RawQuery() string

type CreateSymlinkResponse

type CreateSymlinkResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*CreateSymlinkResponse) UnmarshalHTTP

func (resp *CreateSymlinkResponse) UnmarshalHTTP(httpResp *http.Response) error

type DeleteRequest

type DeleteRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				recursive
	// Description		Should the operation act on the content in the subdirectories?
	// Type				boolean
	// Default Value	false
	// Valid Values		true
	// Syntax			true
	Recursive *bool
}

func (*DeleteRequest) RawPath

func (req *DeleteRequest) RawPath() string

func (*DeleteRequest) RawQuery

func (req *DeleteRequest) RawQuery() string

type DeleteResponse

type DeleteResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	// False if file not exist
	// True if file existed and deleted by this API
	Boolean Boolean `json:"boolean"`
}

func (*DeleteResponse) UnmarshalHTTP

func (resp *DeleteResponse) UnmarshalHTTP(httpResp *http.Response) error

type DeleteSnapshotRequest

type DeleteSnapshotRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
	// Name				snapshotname
	// Description		The name of the snapshot to be created/deleted. Or the new name for snapshot rename.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Snapshot_Name
	Snapshotname *string `json:"snapshotname,omitempty" validate:"required"`
}

func (*DeleteSnapshotRequest) RawPath

func (req *DeleteSnapshotRequest) RawPath() string

func (*DeleteSnapshotRequest) RawQuery

func (req *DeleteSnapshotRequest) RawQuery() string

type DeleteSnapshotResponse

type DeleteSnapshotResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*DeleteSnapshotResponse) UnmarshalHTTP

func (resp *DeleteSnapshotResponse) UnmarshalHTTP(httpResp *http.Response) error

type DiffReportEntry

type DiffReportEntry struct {
	SourcePath string              `json:"sourcePath" validate:"required"` // Source path name relative to snapshot root.
	TargetPath string              `json:"targetPath" validate:"required"` // Target path relative to snapshot root used for renames.
	Type       DiffReportEntryType `json:"type" validate:"required"`       // Type of diff report entry`["CREATE", "MODIFY", "DELETE", "RENAME"]
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#DiffReport_Entries

type DiffReportEntryType

type DiffReportEntryType string
const (
	DiffReportEntryTypeCreate DiffReportEntryType = "CREATE"
	DiffReportEntryTypeModify DiffReportEntryType = "MODIFY"
	DiffReportEntryTypeDelete DiffReportEntryType = "DELETE"
	DiffReportEntryTypeRename DiffReportEntryType = "RENAME"
)

type DirectoryListing

type DirectoryListing struct {
	PartialListing struct {
		FileStatuses FileStatuses `json:"FileStatuses"` // An array of FileStatus
	} `json:"partialListing" validate:"required"` // A partial directory listing
	RemainingEntries int64 `json:"remainingEntries" validate:"required"` // Number of remaining entries
}

A DirectoryListing JSON object represents a batch of directory entries while iteratively listing a directory. It contains a FileStatuses JSON object as well as iteration information. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#DirectoryListing_JSON_Schema

type DisableECPolicyRequest

type DisableECPolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				ecpolicy, Erasure Coding Policy
	// Description		The name of the erasure coding policy.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any valid erasure coding policy name;
	// Syntax			Any string.
	ECPolicy *string `validate:"required"`
}

func (*DisableECPolicyRequest) RawPath

func (req *DisableECPolicyRequest) RawPath() string

func (*DisableECPolicyRequest) RawQuery

func (req *DisableECPolicyRequest) RawQuery() string

type DisableECPolicyResponse

type DisableECPolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*DisableECPolicyResponse) UnmarshalHTTP

func (resp *DisableECPolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type DisallowSnapshotRequest

type DisallowSnapshotRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*DisallowSnapshotRequest) RawPath

func (req *DisallowSnapshotRequest) RawPath() string

func (*DisallowSnapshotRequest) RawQuery

func (req *DisallowSnapshotRequest) RawQuery() string

type DisallowSnapshotResponse

type DisallowSnapshotResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*DisallowSnapshotResponse) UnmarshalHTTP

func (resp *DisallowSnapshotResponse) UnmarshalHTTP(httpResp *http.Response) error

type ECPolicy

type ECPolicy struct {
	Name              string         `json:"name"`
	Schema            ECPolicySchema `json:"schema"`
	CellSize          int64          `json:"cellSize"`
	Id                int64          `json:"id"`
	Codecname         string         `json:"codecname"`
	NumDataUnits      int64          `json:"numDataUnits"`
	NumParityUnits    int64          `json:"numParityUnits"`
	Replicationpolicy bool           `json:"replicationpolicy"`
	SystemPolicy      bool           `json:"systemPolicy"`
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#ECPolicy_JSON_Schema

type ECPolicySchema

type ECPolicySchema struct {
	CodecName      string      `json:"codecName"`
	NumDataUnits   int64       `json:"numDataUnits"`
	NumParityUnits int64       `json:"numParityUnits"`
	ExtraOptions   interface{} `json:"extraOptions"`
}

type EmptyClientOption

type EmptyClientOption struct{}

EmptyClientOption does not alter the configuration. It can be embedded in another structure to build custom options.

This API is EXPERIMENTAL.

type EnableECPolicyRequest

type EnableECPolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				ecpolicy, Erasure Coding Policy
	// Description		The name of the erasure coding policy.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any valid erasure coding policy name;
	// Syntax			Any string.
	ECPolicy *string `validate:"required"`
}

func (*EnableECPolicyRequest) RawPath

func (req *EnableECPolicyRequest) RawPath() string

func (*EnableECPolicyRequest) RawQuery

func (req *EnableECPolicyRequest) RawQuery() string

type EnableECPolicyResponse

type EnableECPolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*EnableECPolicyResponse) UnmarshalHTTP

func (resp *EnableECPolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type ErrorResponse

type ErrorResponse struct {
	RemoteException *RemoteException `json:"RemoteException"`
}

https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Error_Responses

func (ErrorResponse) Exception

func (e ErrorResponse) Exception() error

type FileChecksum

type FileChecksum struct {
	Algorithm string `json:"algorithm" validate:"required"` // The name of the checksum algorithm.
	Bytes     string `json:"bytes" validate:"required"`     // The byte sequence of the checksum in hexadecimal.
	Length    int64  `json:"length" validate:"required"`    // The length of the bytes (not the length of the string).
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#FileChecksum_JSON_Schema

type FileStatusProperties

type FileStatusProperties struct {
	PathPrefix       string                    `json:"-"`                                    // The path prefix, for current file|fir
	AccessTime       time_.UnixTimeMillisecond `json:"accessTime" validate:"required"`       // The access time.
	BlockSize        int64                     `json:"blockSize" validate:"required"`        // The block size of a file.
	ChildrenNum      int64                     `json:"childrenNum"`                          // The number of sub files or dirs
	FileId           int64                     `json:"fileId"`                               // The file id
	Group            string                    `json:"group" validate:"required"`            // The group owner.
	Length           int64                     `json:"length" validate:"required"`           // The number of bytes in a file. in bytes, zero for directories
	ModificationTime time_.UnixTimeMillisecond `json:"modificationTime" validate:"required"` // The modification time.
	Owner            string                    `json:"owner" validate:"required"`            // The user who is the owner.
	PathSuffix       string                    `json:"pathSuffix" validate:"required"`       // The path suffix. for subfile|subdir
	Permission       Permission                `json:"permission" validate:"required"`       // The permission represented as a octal string.
	Replication      int64                     `json:"replication" validate:"required"`      // The number of replication of a file.
	Symlink          string                    `json:"symlink"`                              // The link target of a symlink.
	Type             FileType                  `json:"type" validate:"required"`             // The type of the path object. ["FILE", "DIRECTORY", "SYMLINK"]
}

JavaScript syntax is used to define fileStatusProperties so that it can be referred in both FileStatus and FileStatuses JSON schemas. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#FileStatus_Properties

func (*FileStatusProperties) IsDir added in v0.0.2

func (fi *FileStatusProperties) IsDir() bool

func (*FileStatusProperties) ModTime added in v0.0.2

func (fi *FileStatusProperties) ModTime() time.Time

func (*FileStatusProperties) Mode added in v0.0.2

func (fi *FileStatusProperties) Mode() os.FileMode

func (*FileStatusProperties) Name added in v0.0.2

func (fi *FileStatusProperties) Name() string

FileStatusProperties implements os.FileInfo, and provides information about a file or directory in HDFS.

func (*FileStatusProperties) Size added in v0.0.2

func (fi *FileStatusProperties) Size() int64

func (*FileStatusProperties) Sys added in v0.0.2

func (fi *FileStatusProperties) Sys() interface{}

Sys returns the raw *FileStatusProperties message from the namenode.

type FileStatuses

type FileStatuses struct {
	FileStatus []FileStatus `json:"FileStatus"` // An array of FileStatus
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#FileStatuses_JSON_Schema

func (*FileStatuses) Len added in v0.0.2

func (s *FileStatuses) Len() int

func (*FileStatuses) Less added in v0.0.2

func (s *FileStatuses) Less(i, j int) bool

func (*FileStatuses) Swap added in v0.0.2

func (s *FileStatuses) Swap(i, j int)

type FileType

type FileType string
const (
	FileTypeFile      FileType = "FILE"
	FileTypeDirectory FileType = "DIRECTORY"
	FileTypeSymlink   FileType = "SYMLINK"
)

type GetAllStoragePolicyRequest

type GetAllStoragePolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest
}

func (*GetAllStoragePolicyRequest) RawPath

func (req *GetAllStoragePolicyRequest) RawPath() string

func (*GetAllStoragePolicyRequest) RawQuery

func (req *GetAllStoragePolicyRequest) RawQuery() string

type GetAllStoragePolicyResponse

type GetAllStoragePolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse         `json:"-"`
	BlockStoragePolicies BlockStoragePolicies `json:"BlockStoragePolicies"`
}

func (*GetAllStoragePolicyResponse) UnmarshalHTTP

func (resp *GetAllStoragePolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetAllXAttrsRequest

type GetAllXAttrsRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Encode values after retrieving them.
	// Valid encodings are “text”, “hex”, and “base64”.
	// Values encoded as text strings are enclosed in double quotes ("),
	// and values encoded as hexadecimal and base64 are prefixed with 0x and 0s, respectively.
	// actually, encoding is not required, so nil is allowed.
	Encoding *XAttrValueEncoding //`validate:"required"`
}

func (*GetAllXAttrsRequest) RawPath

func (req *GetAllXAttrsRequest) RawPath() string

func (*GetAllXAttrsRequest) RawQuery

func (req *GetAllXAttrsRequest) RawQuery() string

type GetAllXAttrsResponse

type GetAllXAttrsResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	XAttrs       `json:"XAttrs"` // XAttr array.
}

func (*GetAllXAttrsResponse) UnmarshalHTTP

func (resp *GetAllXAttrsResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetContentSummaryRequest

type GetContentSummaryRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetContentSummaryRequest) RawPath

func (req *GetContentSummaryRequest) RawPath() string

func (*GetContentSummaryRequest) RawQuery

func (req *GetContentSummaryRequest) RawQuery() string

type GetContentSummaryResponse

type GetContentSummaryResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse   `json:"-"`
	ContentSummary ContentSummary `json:"ContentSummary"`
}

func (*GetContentSummaryResponse) UnmarshalHTTP

func (resp *GetContentSummaryResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetDelegationTokenRequest

type GetDelegationTokenRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				renewer
	// Description		The username of the renewer of a delegation token.
	// Type				String
	// Default Value	<empty> (means the current user)
	// Valid Values		Any valid username.
	// Syntax			Any string.
	Renewer *string `json:"renewer,omitempty"`
	// Name				service
	// Description		The name of the service where the token is supposed to be used, e.g. ip:port of the namenode
	// Type				String
	// Default Value	<empty>
	// Valid Values		ip:port in string format or logical name of the service
	// Syntax			Any string.
	Service *string `json:"service,omitempty"`
	// Name				kind
	// Description		The kind of the delegation token requested
	// Type				String
	// Default Value	<empty> (Server sets the default kind for the service)
	// Valid Values		A string that represents token kind e.g “HDFS_DELEGATION_TOKEN” or “WEBHDFS delegation”
	// Syntax			Any string.
	Kind *string `json:"kind,omitempty"`
}

See also: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Get_Delegation_Token

func (*GetDelegationTokenRequest) RawPath

func (req *GetDelegationTokenRequest) RawPath() string

func (*GetDelegationTokenRequest) RawQuery

func (req *GetDelegationTokenRequest) RawQuery() string

type GetDelegationTokenResponse

type GetDelegationTokenResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Token        Token `json:"token"`
}

func (*GetDelegationTokenResponse) UnmarshalHTTP

func (resp *GetDelegationTokenResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetECPolicyRequest

type GetECPolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetECPolicyRequest) RawPath

func (req *GetECPolicyRequest) RawPath() string

func (*GetECPolicyRequest) RawQuery

func (req *GetECPolicyRequest) RawQuery() string

type GetECPolicyResponse

type GetECPolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	ECPolicy     ECPolicy `json:"ECPolicy"`
}

func (*GetECPolicyResponse) UnmarshalHTTP

func (resp *GetECPolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetFileBlockLocationsRequest

type GetFileBlockLocationsRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetFileBlockLocationsRequest) RawPath

func (req *GetFileBlockLocationsRequest) RawPath() string

func (*GetFileBlockLocationsRequest) RawQuery

func (req *GetFileBlockLocationsRequest) RawQuery() string

type GetFileBlockLocationsResponse

type GetFileBlockLocationsResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse   `json:"-"`
	BlockLocations BlockLocations `json:"BlockLocations"`
}

func (*GetFileBlockLocationsResponse) UnmarshalHTTP

func (resp *GetFileBlockLocationsResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetFileChecksumRequest

type GetFileChecksumRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
	// Name				nodirect
	// Description		Disable automatically redirected.
	// Type				bool
	// Default Value	false
	// Valid Values		true|false
	// Syntax			Any Bool.
	NoDirect *bool
}

func (*GetFileChecksumRequest) RawPath

func (req *GetFileChecksumRequest) RawPath() string

func (*GetFileChecksumRequest) RawQuery

func (req *GetFileChecksumRequest) RawQuery() string

type GetFileChecksumResponse

type GetFileChecksumResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	FileChecksum FileChecksum `json:"FileChecksum"`

	NoDirect bool    `json:"-"`
	Location *string `json:"Location"`
}

func (*GetFileChecksumResponse) UnmarshalHTTP

func (resp *GetFileChecksumResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetFileStatusRequest

type GetFileStatusRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetFileStatusRequest) RawPath

func (req *GetFileStatusRequest) RawPath() string

func (*GetFileStatusRequest) RawQuery

func (req *GetFileStatusRequest) RawQuery() string

type GetFileStatusResponse

type GetFileStatusResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	FileStatus   FileStatus `json:"FileStatus"`
}

func (*GetFileStatusResponse) UnmarshalHTTP

func (resp *GetFileStatusResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetHomeDirectoryRequest

type GetHomeDirectoryRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest
}

func (*GetHomeDirectoryRequest) RawPath

func (req *GetHomeDirectoryRequest) RawPath() string

func (*GetHomeDirectoryRequest) RawQuery

func (req *GetHomeDirectoryRequest) RawQuery() string

type GetHomeDirectoryResponse

type GetHomeDirectoryResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Path         string `json:"Path"`
}

func (*GetHomeDirectoryResponse) UnmarshalHTTP

func (resp *GetHomeDirectoryResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetQuotaUsageRequest

type GetQuotaUsageRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetQuotaUsageRequest) RawPath

func (req *GetQuotaUsageRequest) RawPath() string

func (*GetQuotaUsageRequest) RawQuery

func (req *GetQuotaUsageRequest) RawQuery() string

type GetQuotaUsageResponse

type GetQuotaUsageResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	QuotaUsage   QuotaUsage `json:"QuotaUsage"`
}

func (*GetQuotaUsageResponse) UnmarshalHTTP

func (resp *GetQuotaUsageResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetSnapshotDiffRequest

type GetSnapshotDiffRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				oldsnapshotname
	// Description		The old name of the snapshot to be renamed.
	// Type				String
	// Default Value	null
	// Valid Values		An existing snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Old_Snapshot_Name
	Oldsnapshotname *string `json:"oldsnapshotname,omitempty" validate:"required"`
	// Name				snapshotname
	// Description		The name of the snapshot to be created/deleted. Or the new name for snapshot rename.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Snapshot_Name
	Snapshotname *string `json:"snapshotname,omitempty" validate:"required"`
}

func (*GetSnapshotDiffRequest) RawPath

func (req *GetSnapshotDiffRequest) RawPath() string

func (*GetSnapshotDiffRequest) RawQuery

func (req *GetSnapshotDiffRequest) RawQuery() string

type GetSnapshotDiffResponse

type GetSnapshotDiffResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse       `json:"-"`
	SnapshotDiffReport SnapshotDiffReport `json:"SnapshotDiffReport"`
}

func (*GetSnapshotDiffResponse) UnmarshalHTTP

func (resp *GetSnapshotDiffResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetSnapshottableDirectoryListRequest

type GetSnapshottableDirectoryListRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				user.name
	// Description		The authenticated user; see Authentication.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid username.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Username
	Username *string `json:"user.name,omitempty" validate:"required"`
}

func (*GetSnapshottableDirectoryListRequest) RawPath

func (*GetSnapshottableDirectoryListRequest) RawQuery

type GetSnapshottableDirectoryListResponse

type GetSnapshottableDirectoryListResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse               `json:"-"`
	SnapshottableDirectoryList SnapshottableDirectoryList `json:"SnapshottableDirectoryList" validate:"required"` // An array of SnapshottableDirectoryStatus
}

func (*GetSnapshottableDirectoryListResponse) UnmarshalHTTP

func (resp *GetSnapshottableDirectoryListResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetStoragePolicyRequest

type GetStoragePolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string
}

func (*GetStoragePolicyRequest) RawPath

func (req *GetStoragePolicyRequest) RawPath() string

func (*GetStoragePolicyRequest) RawQuery

func (req *GetStoragePolicyRequest) RawQuery() string

type GetStoragePolicyResponse

type GetStoragePolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	BlockStoragePolicy
}

func (*GetStoragePolicyResponse) UnmarshalHTTP

func (resp *GetStoragePolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetTrashRootRequest

type GetTrashRootRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*GetTrashRootRequest) RawPath

func (req *GetTrashRootRequest) RawPath() string

func (*GetTrashRootRequest) RawQuery

func (req *GetTrashRootRequest) RawQuery() string

type GetTrashRootResponse

type GetTrashRootResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Path         string `json:"Path"`
}

func (*GetTrashRootResponse) UnmarshalHTTP

func (resp *GetTrashRootResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetXAttrRequest

type GetXAttrRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// XAttr 			Name
	// Name				xattr.name
	// Description		The XAttr name of a file/directory.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any string prefixed with user./trusted./system./security..
	// Syntax			Any string prefixed with user./trusted./system./security..
	XAttrName *string `validate:"required"`

	// Encode values after retrieving them.
	// Valid encodings are “text”, “hex”, and “base64”.
	// Values encoded as text strings are enclosed in double quotes ("),
	// and values encoded as hexadecimal and base64 are prefixed with 0x and 0s, respectively.
	// actually, encoding is not required, so nil is allowed.
	Encoding *XAttrValueEncoding //`validate:"required"`
}

func (*GetXAttrRequest) RawPath

func (req *GetXAttrRequest) RawPath() string

func (*GetXAttrRequest) RawQuery

func (req *GetXAttrRequest) RawQuery() string

type GetXAttrResponse

type GetXAttrResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	XAttrs       `json:"XAttrs"` // XAttr array.
}

func (*GetXAttrResponse) UnmarshalHTTP

func (resp *GetXAttrResponse) UnmarshalHTTP(httpResp *http.Response) error

type GetXAttrsRequest

type GetXAttrsRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	XAttrNames []string `validate:"required"`

	// Encode values after retrieving them.
	// Valid encodings are “text”, “hex”, and “base64”.
	// Values encoded as text strings are enclosed in double quotes ("),
	// and values encoded as hexadecimal and base64 are prefixed with 0x and 0s, respectively.
	// actually, encoding is not required, so nil is allowed.
	Encoding *XAttrValueEncoding //`validate:"required"`
}

func (*GetXAttrsRequest) RawPath

func (req *GetXAttrsRequest) RawPath() string

func (*GetXAttrsRequest) RawQuery

func (req *GetXAttrsRequest) RawQuery() string

type GetXAttrsResponse

type GetXAttrsResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	XAttrs       `json:"XAttrs"` // XAttr array.
}

func (*GetXAttrsResponse) UnmarshalHTTP

func (resp *GetXAttrsResponse) UnmarshalHTTP(httpResp *http.Response) error

type HttpClient

type HttpClient interface {
	Head(url string) (resp *http.Response, err error)
	Get(url string) (resp *http.Response, err error)
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
}

func GetHttpClient

func GetHttpClient(httpCl *http.Client, kerberosClient *krb.Client, spn string) HttpClient

type HttpRequest added in v0.0.9

type HttpRequest struct {
	// Close indicates whether to close the connection after
	// replying to this request (for servers) or after sending this
	// request and reading its response (for clients).
	//
	// some proxy does not support reuse connection, set Close true to disable it.
	Close bool

	PreSendHandler func(req *http.Request) (*http.Request, error)
}

type HttpResponse

type HttpResponse struct {
	// Indicates that a range of bytes was specified.
	AcceptRanges *string

	// Object data.
	// We guarantee that Body is always non-nil, even on responses without a body or responses with
	// a zero-length body. It is the caller's responsibility to close Body.
	Body io.ReadCloser

	// Specifies caching behavior along the request/reply chain.
	CacheControl *string

	// Specifies presentational information for the object.
	ContentDisposition *string

	// Specifies what content encodings have been applied to the object and thus
	// what decoding mechanisms must be applied to obtain the media-type referenced
	// by the Content-Type header field.
	ContentEncoding *string

	// The language the content is in.
	ContentLanguage *string

	// Size of the body in bytes.
	ContentLength *int64

	// The portion of the object returned in the response.
	ContentRange *string

	// A standard MIME type describing the format of the object data.
	ContentType *string

	// An ETag is an opaque identifier assigned by a web server to a specific version
	// of a resource found at a URL.
	ETag *string

	// The date and time at which the object is no longer cacheable.
	Expires *string `location:"header" locationName:"Expires" type:"string"`

	// Last modified date of the object
	LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp"`
}

func (*HttpResponse) UnmarshalHTTP

func (resp *HttpResponse) UnmarshalHTTP(httpResp *http.Response)

type ListStatusBatchRequest

type ListStatusBatchRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// The pathSuffix of the last item returned in the current batch.
	StartAfter *string
}

func (*ListStatusBatchRequest) RawPath

func (req *ListStatusBatchRequest) RawPath() string

func (*ListStatusBatchRequest) RawQuery

func (req *ListStatusBatchRequest) RawQuery() string

type ListStatusBatchResponse

type ListStatusBatchResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse     `json:"-"`
	DirectoryListing DirectoryListing `json:"directoryListing"`
}

func (*ListStatusBatchResponse) UnmarshalHTTP

func (resp *ListStatusBatchResponse) UnmarshalHTTP(httpResp *http.Response) error

type ListStatusRequest

type ListStatusRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*ListStatusRequest) RawPath

func (req *ListStatusRequest) RawPath() string

func (*ListStatusRequest) RawQuery

func (req *ListStatusRequest) RawQuery() string

type ListStatusResponse

type ListStatusResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	FileStatuses FileStatuses `json:"FileStatuses"`
}

func (*ListStatusResponse) UnmarshalHTTP

func (resp *ListStatusResponse) UnmarshalHTTP(httpResp *http.Response) error

type ListXAttrsRequest

type ListXAttrsRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*ListXAttrsRequest) RawPath

func (req *ListXAttrsRequest) RawPath() string

func (*ListXAttrsRequest) RawQuery

func (req *ListXAttrsRequest) RawQuery() string

type ListXAttrsResponse

type ListXAttrsResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	XAttrNames   XAttrNames `json:"XAttrNames" validate:"required"` // XAttr names.
}

func (*ListXAttrsResponse) UnmarshalHTTP

func (resp *ListXAttrsResponse) UnmarshalHTTP(httpResp *http.Response) error

type MkdirsRequest

type MkdirsRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name	permission
	// Description		The permission of a file/directory.
	// Type	Octal
	// Default Value	644 for files, 755 for directories
	// Valid Values		0 - 1777
	// Syntax			Any radix-8 integer (leading zeros may be omitted.)
	Permission *int
}

func (*MkdirsRequest) RawPath

func (req *MkdirsRequest) RawPath() string

func (*MkdirsRequest) RawQuery

func (req *MkdirsRequest) RawQuery() string

type MkdirsResponse

type MkdirsResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Boolean      Boolean `json:"boolean"`
}

func (*MkdirsResponse) UnmarshalHTTP

func (resp *MkdirsResponse) UnmarshalHTTP(httpResp *http.Response) error

type OpenRequest

type OpenRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	// '/' will be ignored automatically
	Path *string `validate:"required"`

	// Name				offset
	// Description		The starting byte position.
	// Type				long
	// Default Value	0
	// Valid Values		>= 0
	// Syntax			Any integer.
	Offset *int64
	// Name				length
	// Description		The number of bytes to be processed.
	// Type				long
	// Default Value	null (means the entire file)
	// Valid Values		>= 0 or null
	// Syntax			Any integer.
	Length *int64
	// Name				buffersize
	// Description		The size of the buffer used in transferring data.
	// Type				int
	// Default Value	Specified in the configuration.
	// Valid Values		> 0
	// Syntax			Any integer.
	BufferSize *int32
	// Name				nodirect
	// Description		Disable automatically redirected.
	// Type				bool
	// Default Value	false
	// Valid Values		true|false
	// Syntax			Any Bool.
	NoDirect *bool
}

func (*OpenRequest) RawPath

func (req *OpenRequest) RawPath() string

func (*OpenRequest) RawQuery

func (req *OpenRequest) RawQuery() string

type OpenResponse

type OpenResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	NoDirect bool    `json:"-"`
	Location *string `json:"Location"`
}

func (*OpenResponse) UnmarshalHTTP

func (resp *OpenResponse) UnmarshalHTTP(httpResp *http.Response) error

type Permission added in v0.0.4

type Permission uint64

The permission of a file/directory. 644 for files, 755 for directories See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Permission

const (
	DefaultPermissionFile      Permission = 0644
	DefaultPermissionDirectory Permission = 0755
)

func (Permission) MarshalJSON added in v0.0.4

func (p Permission) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for XAttrNamespace

func (Permission) New added in v0.0.8

func (p Permission) New() *Permission

func (Permission) String added in v0.0.4

func (p Permission) String() string

func (*Permission) UnmarshalJSON added in v0.0.4

func (p *Permission) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for XAttrNamespace

type ProxyUser

type ProxyUser struct {
	// Name				user.name
	// Description		The authenticated user; see Authentication.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid username.
	// Syntax			Any string.
	Username *string

	// Name				doas
	// Description		Allowing a proxy user to do as another user.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid username.
	// Syntax			Any string.
	DoAs *string
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Proxy_Users

type Quota

type Quota struct {
	Consumed int64 `json:"consumed" validate:"required"` // The storage type space consumed.
	Quota    int64 `json:"quota" validate:"required"`    // The storage type quota.
}

See also: http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html for more information.

type QuotaUsage

type QuotaUsage struct {
	FileAndDirectoryCount int64     `json:"fileAndDirectoryCount" validate:"required"` // The number of files and directories.
	Quota                 int64     `json:"quota" validate:"required"`                 // The namespace quota of this directory.
	SpaceConsumed         int64     `json:"spaceConsumed" validate:"required"`         // The disk space consumed by the content.
	SpaceQuota            int64     `json:"spaceQuota" validate:"required"`            // The disk space quota.
	TypeQuota             TypeQuota `json:"typeQuota" validate:"required"`
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#QuotaUsage_JSON_Schema

type RemoteException

type RemoteException struct {
	Exception     string `json:"exception" validate:"required"` // Name of the exception
	Message       string `json:"message" validate:"required"`   // Exception message
	JavaClassName string `json:"javaClassName,omitempty"`       // Java class name of the exception
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#RemoteException_JSON_Schema

func (*RemoteException) Error

func (e *RemoteException) Error() string

Error returns the string representation of the error. Satisfies the error interface.

func (*RemoteException) Unwrap

func (e *RemoteException) Unwrap() error

type RemoveXAttrRequest

type RemoveXAttrRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				xattr.name
	// Description		The XAttr name of a file/directory.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any string prefixed with user./trusted./system./security..
	// Syntax			Any string prefixed with user./trusted./system./security..
	XAttrName *string `validate:"required"`
}

func (*RemoveXAttrRequest) RawPath

func (req *RemoveXAttrRequest) RawPath() string

func (*RemoveXAttrRequest) RawQuery

func (req *RemoveXAttrRequest) RawQuery() string

type RemoveXAttrResponse

type RemoveXAttrResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*RemoveXAttrResponse) UnmarshalHTTP

func (resp *RemoveXAttrResponse) UnmarshalHTTP(httpResp *http.Response) error

type RenameRequest

type RenameRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				destination
	// Description		The destination path.
	// Type				Path
	// Default Value	<empty> (an invalid path)
	// Valid Values		An absolute FileSystem path without scheme and authority.
	// Syntax			Any path.
	Destination *string `validate:"required"`
}

func (*RenameRequest) RawPath

func (req *RenameRequest) RawPath() string

func (*RenameRequest) RawQuery

func (req *RenameRequest) RawQuery() string

type RenameResponse

type RenameResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Boolean      Boolean `json:"boolean"`
}

func (*RenameResponse) UnmarshalHTTP

func (resp *RenameResponse) UnmarshalHTTP(httpResp *http.Response) error

type RenameSnapshotRequest

type RenameSnapshotRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
	// Name				oldsnapshotname
	// Description		The old name of the snapshot to be renamed.
	// Type				String
	// Default Value	null
	// Valid Values		An existing snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Old_Snapshot_Name
	Oldsnapshotname *string `json:"oldsnapshotname,omitempty" validate:"required"`
	// Name				snapshotname
	// Description		The name of the snapshot to be created/deleted. Or the new name for snapshot rename.
	// Type				String
	// Default Value	null
	// Valid Values		Any valid snapshot name.
	// Syntax			Any string.
	// See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Snapshot_Name
	Snapshotname *string `json:"snapshotname,omitempty"`
}

func (*RenameSnapshotRequest) RawPath

func (req *RenameSnapshotRequest) RawPath() string

func (*RenameSnapshotRequest) RawQuery

func (req *RenameSnapshotRequest) RawQuery() string

type RenameSnapshotResponse

type RenameSnapshotResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*RenameSnapshotResponse) UnmarshalHTTP

func (resp *RenameSnapshotResponse) UnmarshalHTTP(httpResp *http.Response) error

type RenewDelegationTokenRequest

type RenewDelegationTokenRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Name				token
	// Description		The delegation token used for the operation.
	// Type				String
	// Default Value	<empty>
	// Valid Values		An encoded token.
	// Syntax			See the note in Delegation.
	Token *string `json:"token,omitempty"`
}

func (*RenewDelegationTokenRequest) RawPath

func (req *RenewDelegationTokenRequest) RawPath() string

func (*RenewDelegationTokenRequest) RawQuery

func (req *RenewDelegationTokenRequest) RawQuery() string

type RenewDelegationTokenResponse

type RenewDelegationTokenResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	//Long         Long `json:"long"`
	Long time_.UnixTimeMillisecond `json:"long"`
}

func (*RenewDelegationTokenResponse) UnmarshalHTTP

func (resp *RenewDelegationTokenResponse) UnmarshalHTTP(httpResp *http.Response) error

type Request

type Request interface {
	RawPath() string
	RawQuery() string
}

type SatisfyStoragePolicyRequest

type SatisfyStoragePolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				storagepolicy
	// Description		The name of the storage policy.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any valid storage policy name; see GETALLSTORAGEPOLICY.
	// Syntax			Any string.
	StoragePolicy *string `validate:"required"`
}

func (*SatisfyStoragePolicyRequest) RawPath

func (req *SatisfyStoragePolicyRequest) RawPath() string

func (*SatisfyStoragePolicyRequest) RawQuery

func (req *SatisfyStoragePolicyRequest) RawQuery() string

type SatisfyStoragePolicyResponse

type SatisfyStoragePolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SatisfyStoragePolicyResponse) UnmarshalHTTP

func (resp *SatisfyStoragePolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetECPolicyRequest

type SetECPolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				ecpolicy, Erasure Coding Policy
	// Description		The name of the erasure coding policy.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any valid erasure coding policy name;
	// Syntax			Any string.
	ECPolicy *string `validate:"required"`
}

func (*SetECPolicyRequest) RawPath

func (req *SetECPolicyRequest) RawPath() string

func (*SetECPolicyRequest) RawQuery

func (req *SetECPolicyRequest) RawQuery() string

type SetECPolicyResponse

type SetECPolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetECPolicyResponse) UnmarshalHTTP

func (resp *SetECPolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetOwnerRequest

type SetOwnerRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				owner
	// Description		The username who is the owner of a file/directory.
	// Type				String
	// Default Value	<empty> (means keeping it unchanged)
	// Valid Values		Any valid username.
	// Syntax			Any string.
	Owner *string

	// Name				group
	// Description		The name of a group.
	// Type				String
	// Default Value	<empty> (means keeping it unchanged)
	// Valid Values		Any valid group name.
	// Syntax			Any string.
	Group *string
}

func (*SetOwnerRequest) RawPath

func (req *SetOwnerRequest) RawPath() string

func (*SetOwnerRequest) RawQuery

func (req *SetOwnerRequest) RawQuery() string

type SetOwnerResponse

type SetOwnerResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetOwnerResponse) UnmarshalHTTP

func (resp *SetOwnerResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetPermissionRequest

type SetPermissionRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				permission
	// Description		The permission of a file/directory.
	// Type				Octal
	// Default Value	644 for files, 755 for directories
	// Valid Values		0 - 1777
	// Syntax			Any radix-8 integer (leading zeros may be omitted.)
	Permission *Permission
}

func (*SetPermissionRequest) RawPath

func (req *SetPermissionRequest) RawPath() string

func (*SetPermissionRequest) RawQuery

func (req *SetPermissionRequest) RawQuery() string

type SetPermissionResponse

type SetPermissionResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetPermissionResponse) UnmarshalHTTP

func (resp *SetPermissionResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetReplicationRequest

type SetReplicationRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name			replication
	// Description	The number of replications of a file.
	// Type			short
	// Default Value	Specified in the configuration.
	// Valid Values	> 0
	// Syntax		Any integer.
	Replication *int `validate:"required"`
}

func (*SetReplicationRequest) RawPath

func (req *SetReplicationRequest) RawPath() string

func (*SetReplicationRequest) RawQuery

func (req *SetReplicationRequest) RawQuery() string

type SetReplicationResponse

type SetReplicationResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
	Boolean      Boolean `json:"boolean"`
}

func (*SetReplicationResponse) UnmarshalHTTP

func (resp *SetReplicationResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetStoragePolicyRequest

type SetStoragePolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				storagepolicy
	// Description		The name of the storage policy.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any valid storage policy name; see GETALLSTORAGEPOLICY.
	// Syntax			Any string.
	StoragePolicy *string `validate:"required"`
}

func (*SetStoragePolicyRequest) RawPath

func (req *SetStoragePolicyRequest) RawPath() string

func (*SetStoragePolicyRequest) RawQuery

func (req *SetStoragePolicyRequest) RawQuery() string

type SetStoragePolicyResponse

type SetStoragePolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetStoragePolicyResponse) UnmarshalHTTP

func (resp *SetStoragePolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetTimesRequest

type SetTimesRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				modificationtime
	// Description		The modification time of a file/directory.
	// Type				long
	// Default Value	-1 (means keeping it unchanged)
	// Valid Values		-1 or a timestamp
	// Syntax			Any integer.
	Modificationtime *time_.UnixTimeMillisecond

	// Name				accesstime
	// Description		The access time of a file/directory.
	// Type				long
	// Default Value	-1 (means keeping it unchanged)
	// Valid Values		-1 or a timestamp
	// Syntax			Any integer.
	Accesstime *time_.UnixTimeMillisecond
}

func (*SetTimesRequest) RawPath

func (req *SetTimesRequest) RawPath() string

func (*SetTimesRequest) RawQuery

func (req *SetTimesRequest) RawQuery() string

type SetTimesResponse

type SetTimesResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetTimesResponse) UnmarshalHTTP

func (resp *SetTimesResponse) UnmarshalHTTP(httpResp *http.Response) error

type SetXAttrRequest

type SetXAttrRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				xattr.name
	// Description		The XAttr name of a file/directory.
	// Type				String
	// Default Value	<empty>
	// Valid Values		Any string prefixed with user./trusted./system./security..
	// Syntax			Any string prefixed with user./trusted./system./security..
	XAttrName *string `validate:"required"`
	// Name				xattr.value
	// Description		The XAttr value of a file/directory.
	// Type				String
	// Default Value	<empty>
	// Valid Values		An encoded value.
	// Syntax			Enclosed in double quotes or prefixed with 0x or 0s.
	XAttrValue *string `validate:"required"`
	// Name	flag
	// Description	The XAttr set flag.
	// Type	String
	// Default Value	<empty>
	// Valid Values	CREATE,REPLACE.
	// Syntax	CREATE,REPLACE.
	XAttrFlag *XAttrSetFlag `validate:"required"`
}

func (*SetXAttrRequest) RawPath

func (req *SetXAttrRequest) RawPath() string

func (*SetXAttrRequest) RawQuery

func (req *SetXAttrRequest) RawQuery() string

type SetXAttrResponse

type SetXAttrResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*SetXAttrResponse) UnmarshalHTTP

func (resp *SetXAttrResponse) UnmarshalHTTP(httpResp *http.Response) error

type SnapshotDiffReport

type SnapshotDiffReport struct {
	DiffList     []DiffReportEntry `json:"diffList" validate:"required"`     // An array of DiffReportEntry.
	FromSnapshot string            `json:"fromSnapshot" validate:"required"` // Source snapshot.
	SnapshotRoot string            `json:"snapshotRoot" validate:"required"` // String representation of snapshot root path.
	ToSnapshot   string            `json:"toSnapshot" validate:"required"`   // Destination snapshot.
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#SnapshotDiffReport_JSON_Schema

type SnapshottableDirectoryStatus

type SnapshottableDirectoryStatus struct {
	DirStatus      FileStatusProperties `json:"dirStatus"`                          // Source path name relative to snapshot root.
	ParentFullPath string               `json:"parentFullPath" validate:"required"` // Full path of the parent of snapshottable directory.
	SnapshotNumber int64                `json:"snapshotNumber" validate:"required"` // Number of snapshots created on the snapshottable directory.
	SnapshotQuota  int64                `json:"snapshotQuota" validate:"required"`  // Total number of snapshots allowed on the snapshottable directory.
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#SnapshottableDirectoryStatus

type StorageType

type StorageType string
const (
	StorageTypeRamDisk StorageType = "RAM_DISK"
	StorageTypeSsd     StorageType = "SSD"
	StorageTypeDisk    StorageType = "DISK"
	StorageTypeArchive StorageType = "ARCHIVE"
)

type Token

type Token struct {
	UrlString string `json:"urlString" validate:"required"` // A delegation token encoded as a URL safe string.
}

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Token_JSON_Schema

type TruncateRequest

type TruncateRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`

	// Name				newlength
	// Description		The size the file is to be truncated to.
	// Type				long
	// Valid Values		>= 0
	// Syntax			Any long.
	NewLength *int64 `validate:"required"`
}

func (*TruncateRequest) RawPath

func (req *TruncateRequest) RawPath() string

func (*TruncateRequest) RawQuery

func (req *TruncateRequest) RawQuery() string

type TruncateResponse

type TruncateResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`

	// true: truncate to newlength
	// false: truncate to zero
	Boolean Boolean `json:"boolean"`
}

func (*TruncateResponse) UnmarshalHTTP

func (resp *TruncateResponse) UnmarshalHTTP(httpResp *http.Response) error

type TypeQuota

type TypeQuota struct {
	ARCHIVE Quota `json:"ARCHIVE"`
	DISK    Quota `json:"DISK"`
	SSD     Quota `json:"SSD"`
}

type UnsetECPolicyRequest

type UnsetECPolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*UnsetECPolicyRequest) RawPath

func (req *UnsetECPolicyRequest) RawPath() string

func (*UnsetECPolicyRequest) RawQuery

func (req *UnsetECPolicyRequest) RawQuery() string

type UnsetECPolicyResponse

type UnsetECPolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*UnsetECPolicyResponse) UnmarshalHTTP

func (resp *UnsetECPolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type UnsetStoragePolicyRequest

type UnsetStoragePolicyRequest struct {
	Authentication
	ProxyUser
	CSRF
	HttpRequest

	// Path of the object to get.
	//
	// Path is a required field
	Path *string `validate:"required"`
}

func (*UnsetStoragePolicyRequest) RawPath

func (req *UnsetStoragePolicyRequest) RawPath() string

func (*UnsetStoragePolicyRequest) RawQuery

func (req *UnsetStoragePolicyRequest) RawQuery() string

type UnsetStoragePolicyResponse

type UnsetStoragePolicyResponse struct {
	NameNode string `json:"-"`
	ErrorResponse
	HttpResponse `json:"-"`
}

func (*UnsetStoragePolicyResponse) UnmarshalHTTP

func (resp *UnsetStoragePolicyResponse) UnmarshalHTTP(httpResp *http.Response) error

type XAttr

type XAttr struct {
	Name  string `json:"name" validate:"required"`  // XAttr name.
	Value string `json:"value" validate:"required"` // XAttr value.
}

type XAttrNames

type XAttrNames []string

See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#XAttrNames_JSON_Schema

func (XAttrNames) MarshalJSON added in v0.0.8

func (name XAttrNames) MarshalJSON() ([]byte, error)

func (*XAttrNames) UnmarshalJSON added in v0.0.8

func (names *XAttrNames) UnmarshalJSON(data []byte) error

type XAttrNamespace

type XAttrNamespace int

XAttr Name The XAttr name of a file/directory. Any string prefixed with user./trusted./system./security.. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#XAttr_Name See also: https://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html

const (
	// In HDFS, there are five valid namespaces: user, trusted, system, security, and raw. Each of these namespaces have different access restrictions.
	// The user namespace is the namespace that will commonly be used by client applications.
	// Access to extended attributes in the user namespace is controlled by the corresponding file permissions.
	XAttrNamespaceUser XAttrNamespace = iota // user
	// The trusted namespace is available only to HDFS superusers.
	XAttrNamespaceTrusted XAttrNamespace = iota // trusted
	// The system namespace is reserved for internal HDFS use.
	// This namespace is not accessible through userspace methods, and is reserved for implementing internal HDFS features.
	XAttrNamespaceSystem XAttrNamespace = iota // system
	// The security namespace is reserved for internal HDFS use.
	// This namespace is generally not accessible through userspace methods.
	// One particular use of security is the security.hdfs.unreadable.by.superuser extended attribute.
	// This xattr can only be set on files, and it will prevent the superuser from reading the file's contents.
	// The superuser can still read and modify file metadata, such as the owner, permissions, etc.
	// This xattr can be set and accessed by any user, assuming normal filesystem permissions.
	// This xattr is also write-once, and cannot be removed once set.
	// This xattr does not allow a value to be set.
	XAttrNamespaceSecurity XAttrNamespace = iota // security
	// The raw namespace is reserved for internal system attributes that sometimes need to be exposed.
	// Like system namespace attributes they are not visible to the user
	// except when getXAttr/getXAttrs is called on a file or directory in the /.reserved/raw HDFS directory hierarchy.
	// These attributes can only be accessed by the superuser.
	// An example of where raw namespace extended attributes are used is the distcp utility.
	// Encryption zone meta data is stored in raw.* extended attributes,
	// so as long as the administrator uses /.reserved/raw pathnames in source and target,
	// the encrypted files in the encryption zones are transparently copied.
	XAttrNamespaceRaw XAttrNamespace = iota // raw
)

func ParseXAttrNamespaceString

func ParseXAttrNamespaceString(s string) (XAttrNamespace, error)

ParseXAttrNamespaceString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func XAttrNamespaceValues

func XAttrNamespaceValues() []XAttrNamespace

XAttrNamespaceValues returns all values of the enum

func (XAttrNamespace) MarshalBinary

func (i XAttrNamespace) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface for XAttrNamespace

func (XAttrNamespace) MarshalJSON

func (i XAttrNamespace) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for XAttrNamespace

func (XAttrNamespace) MarshalText

func (i XAttrNamespace) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for XAttrNamespace

func (XAttrNamespace) MarshalYAML

func (i XAttrNamespace) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for XAttrNamespace

func (XAttrNamespace) New

func (i XAttrNamespace) New() *XAttrNamespace

New returns a pointer to a new addr filled with the XAttrNamespace value passed in.

func (XAttrNamespace) Registered

func (i XAttrNamespace) Registered() bool

IsAXAttrNamespace returns "true" if the value is listed in the enum definition. "false" otherwise

func (*XAttrNamespace) Scan

func (i *XAttrNamespace) Scan(value interface{}) error

func (XAttrNamespace) String

func (i XAttrNamespace) String() string

func (*XAttrNamespace) UnmarshalBinary

func (i *XAttrNamespace) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for XAttrNamespace

func (*XAttrNamespace) UnmarshalJSON

func (i *XAttrNamespace) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for XAttrNamespace

func (*XAttrNamespace) UnmarshalText

func (i *XAttrNamespace) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for XAttrNamespace

func (*XAttrNamespace) UnmarshalYAML

func (i *XAttrNamespace) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for XAttrNamespace

func (XAttrNamespace) Value

func (i XAttrNamespace) Value() (driver.Value, error)

type XAttrSetFlag

type XAttrSetFlag string

XAttr set flag The XAttr set flag. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#XAttr_set_flag

const (
	XAttrSetFlagCreate  XAttrSetFlag = "CREATE"
	XAttrSetFlagReplace XAttrSetFlag = "REPLACE"
)

func (XAttrSetFlag) New

func (f XAttrSetFlag) New() *XAttrSetFlag

type XAttrValueEncoding

type XAttrValueEncoding string

The XAttr value encoding. See: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#XAttr_value_encoding

const (
	XAttrValueEncodingText   XAttrValueEncoding = "text"
	XAttrValueEncodingHex    XAttrValueEncoding = "hex"
	XAttrValueEncodingBase64 XAttrValueEncoding = "base64"
)

func (XAttrValueEncoding) New

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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