Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestGetVolumeACL(t *testing.T) {
assertNotNil(t, acl.Owner.Type)
assert.Equal(t, api.PersonaTypeUser, *acl.Owner.Type)
assertNotNil(t, acl.Owner.ID)
assert.Equal(t, user.OnDiskUserIdentity.Id, fmt.Sprintf("UID:%s", acl.Owner.ID.ID))
assert.Equal(t, user.OnDiskUserIdentity.ID, fmt.Sprintf("UID:%s", acl.Owner.ID.ID))
assert.Equal(t, api.PersonaIDTypeUID, acl.Owner.ID.Type)
}

Expand Down Expand Up @@ -80,7 +80,7 @@ func TestSetVolumeOwnerToCurrentUser(t *testing.T) {
assertNotNil(t, acl.Owner.Type)
assert.Equal(t, api.PersonaTypeUser, *acl.Owner.Type)
assertNotNil(t, acl.Owner.ID)
assert.Equal(t, user.OnDiskUserIdentity.Id, fmt.Sprintf("UID:%s", acl.Owner.ID.ID))
assert.Equal(t, user.OnDiskUserIdentity.ID, fmt.Sprintf("UID:%s", acl.Owner.ID.ID))
assert.Equal(t, api.PersonaIDTypeUID, acl.Owner.ID.Type)

err = client.SetVolumeOwner(defaultCtx, volume.Name, "rexray")
Expand Down
6 changes: 3 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ type setupConnection struct {
type VerboseType uint

const (
Verbose_High VerboseType = 0
Verbose_Medium VerboseType = 1
Verbose_Low VerboseType = 2
VerboseHigh VerboseType = 0
VerboseMedium VerboseType = 1
VerboseLow VerboseType = 2
)

type apiVerResponse struct {
Expand Down
6 changes: 3 additions & 3 deletions api/api_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func logRequest(_ context.Context, w io.Writer, req *http.Request, verbose Verbo
fmt.Fprintln(w, " -------------------------")

switch verbose {
case Verbose_Low:
case VerboseLow:
// minimal logging, i.e. print request line only
fmt.Fprintf(w, " %s %s %s\r\n", req.Method, req.URL.RequestURI(), req.Proto)
default:
Expand All @@ -63,10 +63,10 @@ func logResponse(ctx context.Context, res *http.Response, verbose VerboseType) {
var buf []byte

switch verbose {
case Verbose_Low:
case VerboseLow:
// minimal logging, i.e. pirnt status line only
fmt.Fprintf(w, " %s %s\r\n", res.Proto, res.Status)
case Verbose_Medium:
case VerboseMedium:
// print status line + headers
buf, _ = httputil.DumpResponse(res, false)
default:
Expand Down
2 changes: 1 addition & 1 deletion api/v1/api_v1_exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func Unexport(
func GetIsiExports(
ctx context.Context,
client api.Client,
) (resp *getIsiExportsResp, err error) {
) (resp *GetIsiExportsResp, err error) {
// PAPI call: GET https://1.2.3.4:8080/platform/1/protocols/nfs/exports
err = client.Get(ctx, exportsPath, "", nil, nil, &resp)

Expand Down
4 changes: 2 additions & 2 deletions api/v1/api_v1_quotas.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func CreateIsiQuota(

var quotaResp IsiQuota
err := client.Post(ctx, quotaPath, "", nil, nil, data, &quotaResp)
return quotaResp.Id, err
return quotaResp.ID, err
}

// SetIsiQuotaHardThreshold sets the hard threshold of a quota for a directory
Expand Down Expand Up @@ -210,7 +210,7 @@ func UpdateIsiQuotaHardThreshold(
}

var quotaResp IsiQuota
err = client.Put(ctx, quotaPath, quota.Id, nil, nil, data, &quotaResp)
err = client.Put(ctx, quotaPath, quota.ID, nil, nil, data, &quotaResp)
return err
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1/api_v1_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func AddIsiRoleMember(ctx context.Context, client api.Client, roleID string, mem
data := &IsiAccessItemFileGroup{
Type: memberType,
}
if member.Id != nil {
data.Id = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *member.Id)
if member.ID != nil {
data.ID = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *member.ID)
}
if member.Name != nil {
data.Name = *member.Name
Expand All @@ -108,7 +108,7 @@ func AddIsiRoleMember(ctx context.Context, client api.Client, roleID string, mem
func RemoveIsiRoleMember(ctx context.Context, client api.Client, roleID string, member IsiAuthMemberItem) error {
// PAPI call: DELETE https://1.2.3.4:8080/platform/1/roles/{role-id}/members/<member-id>

authMemberID, err := getAuthMemberID(member.Type, member.Name, member.Id)
authMemberID, err := getAuthMemberID(member.Type, member.Name, member.ID)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions api/v1/api_v1_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func GetIsiSnapshots(
ctx context.Context,
client api.Client,
) (resp *getIsiSnapshotsResp, err error) {
) (resp *GetIsiSnapshotsResp, err error) {
// PAPI call: GET https://1.2.3.4:8080/platform/1/snapshot/snapshots
err = client.Get(ctx, snapshotsPath, "", nil, nil, &resp)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func GetIsiSnapshots(
{[]byte("resume"), []byte(resp.Resume)},
}

var newResp *getIsiSnapshotsResp
var newResp *GetIsiSnapshotsResp
// PAPI call: GET https://1.2.3.4:8080/platform/1/snapshot/snapshots?resume=<resume token>
err := client.Get(ctx, snapshotsPath, "", snapshotQS, nil, &newResp)
if err != nil {
Expand All @@ -56,7 +56,7 @@ func GetIsiSnapshots(
resp = newResp
}

isiSnapshotResp := &getIsiSnapshotsResp{
isiSnapshotResp := &GetIsiSnapshotsResp{
SnapshotList: snapshotList,
Total: resp.Total,
Resume: resp.Resume,
Expand All @@ -72,7 +72,7 @@ func GetIsiSnapshot(
) (*IsiSnapshot, error) {
// PAPI call: GET https://1.2.3.4:8080/platform/1/snapshot/snapshots/123
snapshotURL := fmt.Sprintf("%s/%d", snapshotsPath, id)
var resp *getIsiSnapshotsResp
var resp *GetIsiSnapshotsResp
err := client.Get(ctx, snapshotURL, "", nil, nil, &resp)
if err != nil {
return nil, err
Expand All @@ -92,7 +92,7 @@ func GetIsiSnapshotByIdentity(
) (*IsiSnapshot, error) {
// PAPI call: GET https://1.2.3.4:8080/platform/1/snapshot/snapshots/id|name
snapshotURL := fmt.Sprintf("%s/%s", snapshotsPath, identity)
var resp *getIsiSnapshotsResp
var resp *GetIsiSnapshotsResp
err := client.Get(ctx, snapshotURL, "", nil, nil, &resp)
if err != nil {
return nil, err
Expand Down Expand Up @@ -195,7 +195,7 @@ func GetIsiSnapshotFolderWithSize(
ctx context.Context,
client api.Client,
isiPath, name, volume string, accessZone string,
) (resp *getIsiVolumeSizeResp, err error) {
) (resp *GetIsiVolumeSizeResp, err error) {
// PAPI call: GET https://1.2.3.4:8080/namespace/path/to/snapshot?detail=size&max-depth=-1
zone, err := GetZoneByName(ctx, client, accessZone)
if err != nil {
Expand Down
46 changes: 23 additions & 23 deletions api/v1/api_v1_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type VolumeName struct {
Name string `json:"name"`
}

type getIsiVolumesResp struct {
type GetIsiVolumesResp struct {
Children []*VolumeName `json:"children"`
}

Expand All @@ -44,23 +44,23 @@ type Ownership struct {
Type string `json:"type"`
}

type AclRequest struct {
type ACLRequest struct {
Authoritative string `json:"authoritative"`
Action string `json:"action"`
Owner *Ownership `json:"owner"`
Group *Ownership `json:"group,omitempty"`
}

// Isi PAPI volume attributes JSON struct
type getIsiVolumeAttributesResp struct {
type GetIsiVolumeAttributesResp struct {
AttributeMap []struct {
Name string `json:"name"`
Value interface{} `json:"value"`
} `json:"attrs"`
}

// Isi PAPI volume size JSON struct
type getIsiVolumeSizeResp struct {
type GetIsiVolumeSizeResp struct {
AttributeMap []struct {
Name string `json:"name"`
Size int64 `json:"size"`
Expand Down Expand Up @@ -90,17 +90,17 @@ type ExportClientList struct {

// Isi PAPI export Id JSON struct
type postIsiExportResp struct {
Id int `json:"id"`
ID int `json:"id"`
}

// Isi PAPI export attributes JSON structs
type IsiExport struct {
Id int `json:"id"`
ID int `json:"id"`
Paths []string `json:"paths"`
Clients []string `json:"clients"`
}

type getIsiExportsResp struct {
type GetIsiExportsResp struct {
ExportList []*IsiExport `json:"exports"`
}

Expand All @@ -115,7 +115,7 @@ type IsiSnapshot struct {
Created int64 `json:"created"`
Expires int64 `json:"expires"`
HasLocks bool `json:"has_locks"`
Id int64 `json:"id"`
ID int64 `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
PctFilesystem float64 `json:"pct_filesystem"`
Expand All @@ -124,11 +124,11 @@ type IsiSnapshot struct {
ShadowBytes int64 `json:"shadow_bytes"`
Size int64 `json:"size"`
State string `json:"state"`
TargetId int64 `json:"target_it"`
TargetID int64 `json:"target_it"`
TargetName string `json:"target_name"`
}

type getIsiSnapshotsResp struct {
type GetIsiSnapshotsResp struct {
SnapshotList []*IsiSnapshot `json:"snapshots"`
Total int64 `json:"total"`
Resume string `json:"resume"`
Expand All @@ -150,7 +150,7 @@ type isiThresholds struct {
type IsiQuota struct {
Container bool `json:"container,omitempty"`
Enforced bool `json:"enforced,omitempty"`
Id string `json:"id"`
ID string `json:"id"`
IncludeSnapshots bool `json:"include_snapshots,omitempty"`
Linked interface{} `json:"linked,omitempty"`
Notifications string `json:"notifications,omitempty"`
Expand Down Expand Up @@ -224,7 +224,7 @@ type IsiCopySnapshotResp struct {
// IsiAccessItemFileGroup Specifies the persona of the file group.
type IsiAccessItemFileGroup struct {
// Specifies the serialized form of a persona, which can be 'UID:0', 'USER:name', 'GID:0', 'GROUP:wheel', or 'SID:S-1-1'.
Id string `json:"id,omitempty"`
ID string `json:"id,omitempty"`
// Specifies the persona name, which must be combined with a type.
Name string `json:"name,omitempty"`
// Specifies the type of persona, which must be combined with a name. Values can be user, group or wellknown
Expand All @@ -233,7 +233,7 @@ type IsiAccessItemFileGroup struct {

// IsiAuthMemberItem Specifies the persona of the group member. Member can be user or group.
type IsiAuthMemberItem struct {
Id *int32 `json:"id,omitempty"`
ID *int32 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type string `json:"type"`
}
Expand All @@ -242,7 +242,7 @@ type IsiUser struct {
// Specifies the distinguished name for the user.
Dn string `json:"dn"`
// Specifies the DNS domain.
DnsDomain string `json:"dns_domain"`
DNSDomain string `json:"dns_domain"`
// Specifies the domain that the object is part of.
Domain string `json:"domain"`
// Specifies an email address.
Expand All @@ -258,14 +258,14 @@ type IsiUser struct {
// True, if the GID was generated.
GeneratedGid bool `json:"generated_gid"`
// True, if the UID was generated.
GeneratedUid bool `json:"generated_uid"`
GeneratedUID bool `json:"generated_uid"`
// True, if the UPN was generated.
GeneratedUpn bool `json:"generated_upn"`
Gid IsiAccessItemFileGroup `json:"gid"`
// Specifies a home directory for the user.
HomeDirectory string `json:"home_directory"`
// Specifies the user or group ID.
Id string `json:"id"`
ID string `json:"id"`
// If true, indicates that the account is locked.
Locked bool `json:"locked"`
// Specifies the maximum time in seconds allowed before the password expires.
Expand Down Expand Up @@ -295,7 +295,7 @@ type IsiUser struct {
Sid IsiAccessItemFileGroup `json:"sid"`
// Specifies the object type.
Type string `json:"type"`
Uid IsiAccessItemFileGroup `json:"uid"`
UID IsiAccessItemFileGroup `json:"uid"`
// Specifies a principal name for the user.
Upn string `json:"upn"`
// Specifies whether the password for the user can be changed.
Expand Down Expand Up @@ -325,7 +325,7 @@ type IsiUserReq struct {
// Specifies the shell for the user.
Shell *string `json:"shell,omitempty"`
// Specifies a numeric user identifier.
Uid *int32 `json:"uid,omitempty"`
UID *int32 `json:"uid,omitempty"`
// If true, the user account should be unlocked.
Unlock *bool `json:"unlock,omitempty"`
}
Expand All @@ -351,7 +351,7 @@ type IsiUpdateUserReq struct {
// Specifies the shell for the user.
Shell *string `json:"shell,omitempty"`
// Specifies a numeric user identifier.
Uid *int32 `json:"uid,omitempty"`
UID *int32 `json:"uid,omitempty"`
// If true, the user account should be unlocked.
Unlock *bool `json:"unlock,omitempty"`
}
Expand All @@ -368,7 +368,7 @@ type IsiUserListRespResume struct {
// IsiRolePrivilegeItem Specifies the system-defined privilege that may be granted to users.
type IsiRolePrivilegeItem struct {
// Specifies the ID of the privilege.
Id string `json:"id"`
ID string `json:"id"`
// Specifies the name of the privilege.
Name *string `json:"name,omitempty"`
// True, if the privilege is read-only.
Expand All @@ -385,7 +385,7 @@ type IsiRole struct {
// Specifies the privileges granted by this role.
Privileges []IsiRolePrivilegeItem `json:"privileges"`
// Specifies the ID of the role.
Id string `json:"id"`
ID string `json:"id"`
}

type isiRoleListResp struct {
Expand All @@ -403,14 +403,14 @@ type IsiGroup struct {
// Specifies the distinguished name for the user.
Dn string `json:"dn"`
// Specifies the DNS domain.
DnsDomain string `json:"dns_domain"`
DNSDomain string `json:"dns_domain"`
// Specifies the domain that the object is part of.
Domain string `json:"domain"`
// If true, the GID was generated.
GeneratedGid bool `json:"generated_gid"`
Gid IsiAccessItemFileGroup `json:"gid"`
// Specifies the user or group ID.
Id string `json:"id"`
ID string `json:"id"`
// Specifies the groups that this user or group are members of.
MemberOf []IsiAccessItemFileGroup `json:"member_of"`
// Specifies a user or group name.
Expand Down
12 changes: 6 additions & 6 deletions api/v1/api_v1_user_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ func AddIsiGroupMember(ctx context.Context, client api.Client, groupName *string
}

data := &IsiAccessItemFileGroup{}
if member.Id != nil {
data.Id = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *member.Id)
if member.ID != nil {
data.ID = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *member.ID)
}
if member.Name != nil && *member.Name != "" {
data.Name = *member.Name
Expand All @@ -177,7 +177,7 @@ func RemoveIsiGroupMember(ctx context.Context, client api.Client, groupName *str
return err
}

authMemberID, err := getAuthMemberID(member.Type, member.Name, member.Id)
authMemberID, err := getAuthMemberID(member.Type, member.Name, member.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -227,8 +227,8 @@ func CreateIsiGroup(ctx context.Context, client api.Client,
Type: memberType,
}

if m.Id != nil {
member.Id = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *m.Id)
if m.ID != nil {
member.ID = fmt.Sprintf("%sID:%d", strings.ToUpper(memberType)[0:1], *m.ID)
} else if m.Name != nil && *m.Name != "" {
member.Name = *m.Name
} else {
Expand All @@ -249,7 +249,7 @@ func CreateIsiGroup(ctx context.Context, client api.Client,
return "", err
}

return groupResp.Id, nil
return groupResp.ID, nil
}

// UpdateIsiGroupGID updates the group's gid.
Expand Down
Loading