parent
825b1a0a00
commit
abd35f858c
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
// FilterByID returns ListSecurityGroups with specified ID.
|
||||
func (lsg ListSecurityGroups) FilterByID(id uint64) ListSecurityGroups {
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "testing"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -0,0 +1,94 @@
|
||||
package secgroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
// List
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
// ID of the rule
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Traffic direction (inbound/outbound)
|
||||
Direction string `json:"direction"`
|
||||
|
||||
// IP protocol version
|
||||
Ethertype string `json:"ethertype"`
|
||||
|
||||
// Network protocol
|
||||
Protocol string `json:"protocol"`
|
||||
|
||||
// Start port number (for TCP/UDP)
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
|
||||
// End port number (for TCP/UDP)
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
|
||||
// Remote IP prefix in CIDR notation
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "sort"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,43 +0,0 @@
|
||||
package securitygroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
ID uint64 `json:"id"`
|
||||
Direction string `json:"direction"`
|
||||
Ethertype string `json:"ethertype"`
|
||||
Protocol string `json:"protocol"`
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
package cloudapi
|
||||
|
||||
import (
|
||||
securitygroup "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/security_group"
|
||||
secgroup "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/secgroup"
|
||||
)
|
||||
|
||||
// Accessing the Security Group method group
|
||||
func (ca *CloudAPI) SecurityGroup() *securitygroup.SecurityGroup {
|
||||
return securitygroup.New(ca.client)
|
||||
func (ca *CloudAPI) SecurityGroup() *secgroup.SecurityGroup {
|
||||
return secgroup.New(ca.client)
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package cloudapi
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stpolicy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (ca *CloudAPI) StPolicy() *stpolicy.StPolicy {
|
||||
return stpolicy.New(ca.client)
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
package storagepolicy
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSepPools []AccessSepPool
|
||||
|
||||
type AccessSepPool struct {
|
||||
SepID uint64 `json:"sep_id"`
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package cloudapi
|
||||
|
||||
import (
|
||||
storagepolicy "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/storage_policy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (ca *CloudAPI) StoragePolicy() *storagepolicy.StoragePolicy {
|
||||
return storagepolicy.New(ca.client)
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package stpolicy
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
// List
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
|
||||
// Entry Count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSEPPools []AccessSEPPool
|
||||
|
||||
type AccessSEPPool struct {
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP name
|
||||
Name string `json:"sep_name"`
|
||||
|
||||
// Pool names
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
// List of accounts
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
|
||||
// List of resource groups
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to storage policy
|
||||
type StoragePolicy struct {
|
||||
type StPolicy struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
func New(client interfaces.Caller) *StoragePolicy {
|
||||
return &StoragePolicy{
|
||||
func New(client interfaces.Caller) *StPolicy {
|
||||
return &StPolicy{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateStorageListRequest struct to get list of jobs
|
||||
type MigrateStorageListRequest struct {
|
||||
// Find by job ID
|
||||
// Required: false
|
||||
MigrationJobID uint64 `url:"migration_job_id,omitempty" json:"migration_job_id,omitempty"`
|
||||
|
||||
// If True then return completed jobs
|
||||
// Required: false
|
||||
Completed interface{} `url:"completed,omitempty" json:"completed,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// MigrateStorageList gets list of the jobs.
|
||||
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/migrate_storage_list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListMigrateStorage{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// StartMigrationINRequest struct to start compute for external migration in
|
||||
type StartMigrationINRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// ID of the stack where the compute will be staged for migration-in
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
}
|
||||
|
||||
// StartMigrationIN starts compute for external migration in
|
||||
func (c Compute) StartMigrationIN(ctx context.Context, req StartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/start_migration_in"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// StopMigrationINRequest struct to stop compute for external migration in
|
||||
type StopMigrationINRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// If provided, indicates the UUID of the VM on the target host and that migration completed.
|
||||
// Required: false
|
||||
NewVMUUID string `url:"new_vm_uuid,omitempty" json:"new_vm_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// StopMigrationIN stops compute for external migration in
|
||||
func (c Compute) StopMigrationIN(ctx context.Context, req StartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/stop_migration_in"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateNodesRequest struct to update nodes
|
||||
type UpdateNodesRequest struct {
|
||||
// Image ID
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
|
||||
|
||||
// List of stacks
|
||||
// Required: false
|
||||
EnabledStacks []uint64 `url:"enabledStacks,omitempty" json:"enabledStacks,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateNodes updates image availability on nodes
|
||||
func (i Image) UpdateNodes(ctx context.Context, req UpdateNodesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/image/updateNodes"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AddSSHIdentityRequest struct to add node ssh information
|
||||
type AddSSHIdentityRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Host name of the client
|
||||
// Required: true
|
||||
ClientHostName string `url:"client_host_name" json:"client_host_name" validate:"required"`
|
||||
|
||||
// SSH host key of the client
|
||||
// Required: true
|
||||
ClientHostKey string `url:"client_host_key" json:"client_host_key" validate:"required" `
|
||||
|
||||
// SSH public key of the client
|
||||
// Required: true
|
||||
ClientPublicKey string `url:"client_public_key" json:"client_public_key" validate:"required"`
|
||||
|
||||
// IPv4 address
|
||||
// Required: true
|
||||
ClientIPAddress string `url:"client_ip_address" json:"client_ip_address" validate:"required" `
|
||||
}
|
||||
|
||||
// AddSSHIdentity adds node ssh information
|
||||
func (n Node) AddSSHIdentity(ctx context.Context, req AddSSHIdentityRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/add_ssh_identity"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetSSHIdentityRequest struct to get node ssh information
|
||||
type GetSSHIdentityRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
}
|
||||
|
||||
// GetSSHIdentity gets node ssh information
|
||||
func (n Node) GetSSHIdentity(ctx context.Context, req GetSSHIdentityRequest) (*SSHIdentity, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/get_ssh_identity"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := SSHIdentity{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
// FilterByID returns ListSecurityGroups with specified ID.
|
||||
func (lsg ListSecurityGroups) FilterByID(id uint64) ListSecurityGroups {
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "testing"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -0,0 +1,94 @@
|
||||
package secgroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
// List
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
// ID of the rule
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Traffic direction (inbound/outbound)
|
||||
Direction string `json:"direction"`
|
||||
|
||||
// IP protocol version
|
||||
Ethertype string `json:"ethertype"`
|
||||
|
||||
// Network protocol
|
||||
Protocol string `json:"protocol"`
|
||||
|
||||
// Start port number (for TCP/UDP)
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
|
||||
// End port number (for TCP/UDP)
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
|
||||
// Remote IP prefix in CIDR notation
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "sort"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -1,43 +0,0 @@
|
||||
package securitygroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
ID uint64 `json:"id"`
|
||||
Direction string `json:"direction"`
|
||||
Ethertype string `json:"ethertype"`
|
||||
Protocol string `json:"protocol"`
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
securitygroup "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/security_group"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/secgroup"
|
||||
)
|
||||
|
||||
// Accessing the Security Group method group
|
||||
func (cb *CloudBroker) SecurityGroup() *securitygroup.SecurityGroup {
|
||||
return securitygroup.New(cb.client)
|
||||
func (cb *CloudBroker) SecurityGroup() *secgroup.SecurityGroup {
|
||||
return secgroup.New(cb.client)
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stpolicy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (cb *CloudBroker) StPolicy() *stpolicy.StPolicy {
|
||||
return stpolicy.New(cb.client)
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
package storagepolicy
|
||||
|
||||
type InfoStoragePolicyWithID struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSepPools []AccessSepPool
|
||||
|
||||
type AccessSepPool struct {
|
||||
SepID uint64 `json:"sep_id"`
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
storagepolicy "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/storage_policy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (cb *CloudBroker) StoragePolicy() *storagepolicy.StoragePolicy {
|
||||
return storagepolicy.New(cb.client)
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
// FilterByID returns ListStoragePolicies with specified ID.
|
||||
func (lsp ListStoragePolicies) FilterByID(id uint64) ListStoragePolicies {
|
||||
@ -0,0 +1,108 @@
|
||||
package stpolicy
|
||||
|
||||
type InfoStoragePolicyWithID struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// ID of the storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
// List
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
|
||||
// Entry Count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the storage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSEPPools []AccessSEPPool
|
||||
|
||||
type AccessSEPPool struct {
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP name
|
||||
Name string `json:"sep_name"`
|
||||
|
||||
// Pool names
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
// List of accounts
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
|
||||
// List of resource groups
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to storage policy
|
||||
type StoragePolicy struct {
|
||||
type StPolicy struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
func New(client interfaces.Caller) *StoragePolicy {
|
||||
return &StoragePolicy{
|
||||
func New(client interfaces.Caller) *StPolicy {
|
||||
return &StPolicy{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue