Documentation
¶
Index ¶
- type AccessLevel
- type DeleteUserAccessRequest
- type Namespace
- type NamespaceAdminCreateRequest
- type NamespaceAdminResizeRequest
- type NamespaceCreateRequest
- type NamespaceRenameRequest
- type NamespaceResizeRequest
- type NamespaceWithPermissions
- type NamespaceWithPermissionsJSON
- type Permission
- type Resource
- type ResourceType
- type SetUserAccessRequest
- type SetUserAccessesRequest
- type Storage
- type UpdateStorageRequest
- type Volume
- type VolumeCreateRequest
- type VolumeRenameRequest
- type VolumeResizeRequest
- type VolumeWithPermissions
- type VolumeWithPermissionsJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessLevel ¶
type AccessLevel string // enum
swagger:ignore
const ( AccessNone AccessLevel = "none" AccessRead AccessLevel = "read" AccessReadDelete AccessLevel = "readdelete" AccessWrite AccessLevel = "write" AccessOwner AccessLevel = "owner" )
func (*AccessLevel) UnmarshalJSON ¶
func (al *AccessLevel) UnmarshalJSON(b []byte) error
type DeleteUserAccessRequest ¶
type DeleteUserAccessRequest struct {
// swagger:strfmt email
UserName string `json:"username"`
}
DeleteUserAccessRequest is a request object for deleting access to resource for user
swagger:model DeleteResourceAccessRequest
type Namespace ¶
type Namespace struct {
Resource
RAM int `sql:"ram,notnull" json:"ram"`
CPU int `sql:"cpu,notnull" json:"cpu"`
MaxExtServices int `sql:"max_ext_services,notnull" json:"max_external_services"`
MaxIntServices int `sql:"max_int_services,notnull" json:"max_internal_services"`
MaxTraffic int `sql:"max_traffic,notnull" json:"max_traffic"`
Volumes []*VolumeWithPermissions `pg:"fk:ns_id" sql:"-" json:"volumes,omitempty"`
// contains filtered or unexported fields
}
Namespace describes namespace
swagger:model
type NamespaceAdminCreateRequest ¶
type NamespaceAdminCreateRequest struct {
Label string `json:"label" binding:"required"`
CPU int `json:"cpu" binding:"required"`
Memory int `json:"memory" binding:"required"`
MaxExtServices int `json:"max_ext_services" binding:"required"`
MaxIntServices int `json:"max_int_services" binding:"required"`
MaxTraffic int `json:"max_traffic" binding:"required"`
}
NamespaceAdminCreateRequest contains parameters for creating namespace without billing
swagger:model
type NamespaceAdminResizeRequest ¶
type NamespaceAdminResizeRequest struct {
CPU *int `json:"cpu"`
Memory *int `json:"memory"`
MaxExtServices *int `json:"max_ext_services"`
MaxIntServices *int `json:"max_int_services"`
MaxTraffic *int `json:"max_traffic"`
}
NamespaceAdminResizeRequest contains parameter for resizing namespace without billing
swagger:model
type NamespaceCreateRequest ¶
type NamespaceCreateRequest struct {
// swagger:strfmt uuid
TariffID string `json:"tariff_id" binding:"required,uuid"`
Label string `json:"label" binding:"required"`
}
NamespaceCreateRequest contains parameters for creating namespace
swagger:model
type NamespaceRenameRequest ¶
type NamespaceRenameRequest struct {
Label string `json:"label" binding:"required"`
}
NamespaceRenameRequest contains parameters for renaming namespace
swagger:model
type NamespaceResizeRequest ¶
type NamespaceResizeRequest struct {
// swagger:strfmt uuid
TariffID string `json:"tariff_id" binding:"required,uuid"`
}
NamespaceResizeRequest contains parameters for changing namespace quota
swagger:model
type NamespaceWithPermissions ¶
type NamespaceWithPermissions struct {
Namespace `pg:",override"`
Permission Permission `pg:"fk:resource_id" sql:"-" json:",inline"`
Permissions []Permission `pg:"polymorphic:resource_" sql:"-" json:"users"`
}
swagger:ignore
func (NamespaceWithPermissions) MarshalJSON ¶
func (np NamespaceWithPermissions) MarshalJSON() ([]byte, error)
Workaround while json "inline" tag not inlines fields on marshal
func (*NamespaceWithPermissions) Mask ¶
func (np *NamespaceWithPermissions) Mask()
func (*NamespaceWithPermissions) UnmarshalJSON ¶
func (np *NamespaceWithPermissions) UnmarshalJSON(b []byte) error
type NamespaceWithPermissionsJSON ¶
type NamespaceWithPermissionsJSON struct {
Namespace
Permission
Permissions []Permission `json:"users"`
}
NamespaceWithPermissions is a response object for get requests
swagger:model NamespaceWithPermissions
type Permission ¶
type Permission struct {
// swagger:strfmt uuid
ID string `sql:"perm_id,pk,type:uuid,default:uuid_generate_v4()" json:"perm_id,omitempty"`
ResourceType ResourceType `sql:"resource_type,notnull,unique:unique_user_access" json:"kind,omitempty"` // WARN: custom type here, do not forget create it
// swagger:strfmt uuid
ResourceID string `sql:"resource_id,type:uuid,notnull,unique:unique_user_access" json:"resource_id,omitempty"`
CreateTime *time.Time `sql:"create_time,default:now(),notnull" json:"create_time,omitempty"`
// swagger:strfmt uuid
UserID string `sql:"user_id,type:uuid,notnull,unique:unique_user_access" json:"user_id,omitempty"`
// swagger:strfmt email
UserLogin string `sql:"-" json:"login,omitempty"`
InitialAccessLevel AccessLevel `sql:"initial_access_level,type:ACCESS_LEVEL,notnull" json:"access,omitempty"` // WARN: custom type here, do not forget create it
CurrentAccessLevel AccessLevel `sql:"current_access_level,type:ACCESS_LEVEL,notnull" json:"new_access_level,omitempty"` // WARN: custom type here, do not forget create it
AccessLevelChangeTime *time.Time `sql:"access_level_change_time,default:now(),notnull" json:"access_level_change_time,omitempty"`
// contains filtered or unexported fields
}
Permission represents information about user permission to resource
swagger:model
func (*Permission) BeforeInsert ¶
func (p *Permission) BeforeInsert(db orm.DB) error
func (*Permission) BeforeUpdate ¶
func (p *Permission) BeforeUpdate(db orm.DB) error
func (*Permission) Mask ¶
func (p *Permission) Mask()
type Resource ¶
type Resource struct {
// swagger:strfmt uuid
ID string `sql:"id,pk,type:uuid,default:uuid_generate_v4()" json:"id,omitempty"`
CreateTime *time.Time `sql:"create_time,default:now(),notnull" json:"create_time,omitempty"`
Deleted bool `sql:"deleted,notnull" json:"deleted,omitempty"`
DeleteTime *time.Time `sql:"delete_time" json:"delete_time,omitempty"`
// swagger:strfmt uuid
TariffID *string `sql:"tariff_id,type:uuid" json:"tariff_id,omitempty"`
// swagger:strfmt uuid
OwnerUserID string `sql:"owner_user_id,type:uuid,notnull" json:"owner_user_id,omitempty"`
// swagger:strfmt email
OwnerUserLogin string `sql:"-" json:"owner_user_login,omitempty"`
Label string `sql:"label,notnull" json:"label"`
}
Resource represents common resource information.
swagger:ignore
type ResourceType ¶
type ResourceType string
const ( ResourceNamespace ResourceType = "Namespace" ResourceVolume ResourceType = "Volume" )
type SetUserAccessRequest ¶
type SetUserAccessRequest struct {
// swagger:strfmt email
UserName string `json:"username"`
Access AccessLevel `json:"access"`
}
SetUserAccessRequest is a request object for setting access to resource for user
swagger:model SetResourceAccessRequest
type SetUserAccessesRequest ¶
type SetUserAccessesRequest struct {
Access AccessLevel `json:"access"`
}
SetUserAccessRequest is a request object for setting user accesses
swagger:model SetResourcesAccessesRequest
type Storage ¶
type Storage struct {
// swagger:strfmt uuid
ID string `sql:"id,pk,type:uuid,default:uuid_generate_v4()" json:"id,omitempty"`
Name string `sql:"name,notnull,unique" json:"name"`
Size int `sql:"size,notnull" json:"size"`
Used int `sql:"used,notnull" json:"used"`
Replicas int `sql:"replicas,notnull" json:"replicas"`
IPs []string `sql:"ips,notnull,type:inet[],array" json:"ips"`
Volumes []*Volume `pg:"fk:storage_id" sql:"-" json:"volumes"`
// contains filtered or unexported fields
}
Storage describes volumes storage
swagger:model
type UpdateStorageRequest ¶
type UpdateStorageRequest struct {
Name *string `json:"name,omitempty"`
Size *int `json:"size,omitempty"`
Replicas *int `json:"replicas,omitempty"`
IPs []string `json:"ips,omitempty"`
}
UpdateStorageRequest represents request object for updating storage
swagger:model
type Volume ¶
type Volume struct {
Resource
Active *bool `sql:"active,notnull" json:"active,omitempty"`
Capacity int `sql:"capacity,notnull" json:"capacity"`
Replicas int `sql:"replicas,notnull" json:"replicas"`
// swagger:strfmt uuid
NamespaceID *string `sql:"ns_id,type:uuid" json:"namespace_id,omitempty"`
GlusterName string `sql:"gluster_name,notnull" json:"gluster_name,omitempty"`
// swagger:strfmt uuid
StorageID string `sql:"storage_id,type:uuid,notnull" json:"storage_id,omitempty"`
// contains filtered or unexported fields
}
Volume describes volume
swagger:model
type VolumeCreateRequest ¶
type VolumeCreateRequest struct {
// swagger:strfmt uuid
TariffID string `json:"tariff_id" binding:"required,uuid"`
Label string `json:"label" binding:"required"`
}
VolumeCreateRequest is a request object for creating volume
swagger:model
type VolumeRenameRequest ¶
type VolumeRenameRequest struct {
Label string `json:"label" binding:"required"`
}
VolumeRenameRequest is a request object for renaming volume
swagger:model
type VolumeResizeRequest ¶
type VolumeResizeRequest struct {
// swagger:strfmt uuid
TariffID string `json:"tariff_id" binding:"required,uuid"`
}
VolumeResizeRequest contains parameters for changing volume size
swagger:model
type VolumeWithPermissions ¶
type VolumeWithPermissions struct {
Volume `pg:",override"`
Permission Permission `pg:"fk:resource_id" sql:"-" json:",inline"`
Permissions []Permission `pg:"polymorphic:resource_" sql:"-" json:"users"`
}
swagger:ignore
func (VolumeWithPermissions) MarshalJSON ¶
func (vp VolumeWithPermissions) MarshalJSON() ([]byte, error)
Workaround while json "inline" tag not inlines fields on marshal
func (*VolumeWithPermissions) Mask ¶
func (vp *VolumeWithPermissions) Mask()
func (*VolumeWithPermissions) UnmarshalJSON ¶
func (vp *VolumeWithPermissions) UnmarshalJSON(b []byte) error
type VolumeWithPermissionsJSON ¶
type VolumeWithPermissionsJSON struct {
Volume
Permission
Permissions []Permission `json:"users"`
}
VolumeWithPermissions is a response object for get requests
swagger:model VolumeWithPermissions