parent
a85ad3acd5
commit
cd741b7f11
@ -1,4 +1,30 @@
|
|||||||
## Version 1.7.1
|
## Version 1.7.2
|
||||||
|
|
||||||
## Bugfix
|
## Bugfix
|
||||||
- Fix panic in clients
|
- Fix panic in clients
|
||||||
|
- Add refresh Token in BVS authorization mode and refactoring bvs_client
|
||||||
|
- Delete tag validate and omitempty in Permanently field, DeleteRequest model in cloudApi/k8s/delete cloudBroker/k8s/delete
|
||||||
|
- Add Page and Size fields into model AffinityGroupsListRequest in cloudbroker/rg/affinity_groups_list;
|
||||||
|
- Change type of Data field from for model ListAffinityGroup in cloudbroker/rg/affinity_groups_list for correct parsing;
|
||||||
|
- Add new models ListAffinityGroupItems and ItemAffinityGroup to support correct parsing for model ListAffinityGroup in cloudbroker/rg/affinity_groups_list;
|
||||||
|
- Add missing IDs() method for model ListAffinityGroupItems in cloudbroker/rg/affinity_groups_list;
|
||||||
|
- Add ResourceLimits field into model ItemResourceConsumption in cloudbroker/rg/models;
|
||||||
|
- Add LockStatus field into model ListRequest in cloudbroker/rg/list;
|
||||||
|
- Fix url for cloudbroker/grid/getDiagnosisGet
|
||||||
|
- Create ListUsers model with Data and EntryCount fields in cloudbroker/compute/models;
|
||||||
|
- Change type of return structure for UserList method from RecordACL to ListUsers in cloudbroker/compute/user_list;
|
||||||
|
- Create ListSnapShot model with Data and EntryCount fields in cloudbroker/compute/models;
|
||||||
|
- Change type of return structure for SnapshotList from ListSnapshots to *ListSnapShot in cloudbroker/compute/snapshot_list;
|
||||||
|
- Change json tag for TotalDiskSize field for model ItemCompute in cloudbroker/compute/models;
|
||||||
|
- Add NeedReboot and CdImageId fields for model InfoCompute in cloudbroker/compute/models;
|
||||||
|
- Reorganize ListPFW model by adding Data and EntryCount fields with json tags in cloudbroker/compute/models;
|
||||||
|
- Fix IDs() method for ListPFW model in cloudbroker/compute/ids;
|
||||||
|
- Change type of return structure for PFWList method from ListPFW to *ListPFW in cloudbroker/compute/pfw_list.
|
||||||
|
|
||||||
|
|
||||||
|
## Feature
|
||||||
|
- Add endpoints AccessAdd AccessRemote in cloudBroker/k8ci
|
||||||
|
- Add endpoints Audit in cloudBroker
|
||||||
|
- Add AuthBroker field to model RecordGrid in cloudbroker/grid/models
|
||||||
|
- Add AuthBroker field to model ItemGridList in cloudbroker/grid/models
|
||||||
|
- Add endpoints DeleteCustomFields in cloudbroker/compute
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package constants
|
||||||
|
|
||||||
|
const Restmachine = "/restmachine"
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package cloudbroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/audit"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the Stack method group
|
||||||
|
func (cb *CloudBroker) Audit() *audit.Audit {
|
||||||
|
return audit.New(cb.client)
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||||
|
|
||||||
|
// Structure for creating request to audit
|
||||||
|
type Audit struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for audit endpoint
|
||||||
|
func New(client interfaces.Caller) *Audit{
|
||||||
|
return &Audit{
|
||||||
|
client: client,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get information about account
|
||||||
|
type GetRequest struct {
|
||||||
|
// Audit GUID
|
||||||
|
// Required: true
|
||||||
|
AuditGuid string `url:"auditGuid" json:"auditGuid" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets information about audit as a RecordAudit struct
|
||||||
|
func (a Audit) Get(ctx context.Context, req GetRequest) (*RecordAudit, error) {
|
||||||
|
res, err := a.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordAudit{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets information about audit as an array of bytes
|
||||||
|
func (a Audit) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/audit/get"
|
||||||
|
|
||||||
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LinkedJobsRequest struct to get information about jobs linked with Audit
|
||||||
|
type LinkedJobsRequest struct {
|
||||||
|
// Audit GUID
|
||||||
|
// Required: true
|
||||||
|
AuditGuid string `url:"auditGuid" json:"auditGuid" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// LinkedJobs gets information about Linked Jobs as a ListLinkedJobs struct
|
||||||
|
func (a Audit) LinkedJobs(ctx context.Context, req LinkedJobsRequest) (*ListLinkedJobs, error) {
|
||||||
|
res, err := a.GetRawLinkedJobs(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := ListLinkedJobs{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRawLinkedJobs gets information about Linked Jobs as an array of bytes
|
||||||
|
func (a Audit) GetRawLinkedJobs(ctx context.Context, req LinkedJobsRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/audit/linkedJobs"
|
||||||
|
|
||||||
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to give list of account audits
|
||||||
|
type ListRequest struct {
|
||||||
|
|
||||||
|
// Find all audits after point in time (unixtime)
|
||||||
|
// Required: false
|
||||||
|
TimestampAt uint64 `url:"timestampAt,omitempty" json:"timestampAt,omitempty"`
|
||||||
|
|
||||||
|
// Find all audits before point in time (unixtime)
|
||||||
|
// Required: false
|
||||||
|
TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"`
|
||||||
|
|
||||||
|
// Find by user (Mongo RegExp supported)
|
||||||
|
// Required: false
|
||||||
|
User string `url:"user,omitempty" json:"user,omitempty"`
|
||||||
|
|
||||||
|
// Find by api endpoint (Mongo RegExp supported)
|
||||||
|
// Required: false
|
||||||
|
Call string `url:"call,omitempty" json:"call,omitempty"`
|
||||||
|
|
||||||
|
// Find by HTTP status code
|
||||||
|
// Required: false
|
||||||
|
StatusCode uint64 `url:"statusCode,omitempty" json:"statusCode,omitempty"`
|
||||||
|
|
||||||
|
// Page number
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Page size
|
||||||
|
// Required: false
|
||||||
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets audit records for the specified account object
|
||||||
|
func (a Audit) List(ctx context.Context, req ListRequest) (*ListAudits, error) {
|
||||||
|
res, err := a.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := ListAudits{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &list)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &list, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets list of audit records an array of bytes
|
||||||
|
func (a Audit) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
url := "/cloudbroker/audit/list"
|
||||||
|
|
||||||
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
// Main info about audit
|
||||||
|
type ItemAudit struct {
|
||||||
|
// Call
|
||||||
|
Call string `json:"call"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID string `json:"guid"`
|
||||||
|
|
||||||
|
// Response time
|
||||||
|
ResponseTime float64 `json:"responsetime"`
|
||||||
|
|
||||||
|
// Status code
|
||||||
|
StatusCode uint64 `json:"statuscode"`
|
||||||
|
|
||||||
|
// Timestamp
|
||||||
|
Timestamp float64 `json:"timestamp"`
|
||||||
|
|
||||||
|
// User
|
||||||
|
User string `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of audits
|
||||||
|
type ListAudits struct {
|
||||||
|
// Data
|
||||||
|
Data []ItemAudit `json:"data"`
|
||||||
|
|
||||||
|
// EntryCount
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main info about audit
|
||||||
|
type RecordAudit struct {
|
||||||
|
|
||||||
|
// Apitask
|
||||||
|
Apitask string `json:"apitask"`
|
||||||
|
|
||||||
|
// Arguments
|
||||||
|
Arguments string `json:"args"`
|
||||||
|
|
||||||
|
// Call
|
||||||
|
Call string `json:"call"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID string `json:"guid"`
|
||||||
|
|
||||||
|
// Kwargs
|
||||||
|
Kwargs string `json:"kwargs"`
|
||||||
|
|
||||||
|
// RemoteAddr
|
||||||
|
RemoteAddr string `json:"remote_addr"`
|
||||||
|
|
||||||
|
// Response time
|
||||||
|
ResponseTime float64 `json:"responsetime"`
|
||||||
|
|
||||||
|
// Result
|
||||||
|
Result string `json:"result"`
|
||||||
|
|
||||||
|
// Status code
|
||||||
|
StatusCode uint64 `json:"statuscode"`
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
Tags string `json:"tags"`
|
||||||
|
|
||||||
|
// Timestamp
|
||||||
|
Timestamp float64 `json:"timestamp"`
|
||||||
|
|
||||||
|
// TimestampEnd
|
||||||
|
TimestampEnd float64 `json:"timestampEnd"`
|
||||||
|
|
||||||
|
// User
|
||||||
|
User string `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of Linked Jobs
|
||||||
|
type ListLinkedJobs []ItemLinkedJobs
|
||||||
|
|
||||||
|
// Main info about Linked Jobs
|
||||||
|
type ItemLinkedJobs struct {
|
||||||
|
|
||||||
|
// CMD
|
||||||
|
CMD string `json:"cmd"`
|
||||||
|
|
||||||
|
// NID
|
||||||
|
NID uint64 `json:"nid"`
|
||||||
|
|
||||||
|
// state
|
||||||
|
State string `json:"state"`
|
||||||
|
|
||||||
|
// TimeCreate
|
||||||
|
TimeCreate uint64 `json:"timeCreate"`
|
||||||
|
|
||||||
|
// TimeStart
|
||||||
|
TimeStart uint64 `json:"timeStart"`
|
||||||
|
|
||||||
|
// TimeStop
|
||||||
|
TimeStop uint64 `json:"timeStop"`
|
||||||
|
|
||||||
|
// Timeout
|
||||||
|
Timeout uint64 `json:"timeout"`
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package compute
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteCustomFieldsRequest struct to delete compute's custom fields
|
||||||
|
type DeleteCustomFieldsRequest struct {
|
||||||
|
// ID of the compute
|
||||||
|
// Required: true
|
||||||
|
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCustomFields deletes computes custom fields
|
||||||
|
func (c Compute) DeleteCustomFields(ctx context.Context, req DeleteCustomFieldsRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/compute/deleteCustomFields"
|
||||||
|
|
||||||
|
res, err := c.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,36 @@
|
|||||||
|
package k8ci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccessAddRequest struct for adding permission to access to account for a k8ci
|
||||||
|
type AccessAddRequest struct {
|
||||||
|
// ID of the K8 catalog item to add access for
|
||||||
|
// Required: true
|
||||||
|
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
|
||||||
|
|
||||||
|
// Account ID to add to the sharedWith access list
|
||||||
|
// Required: true
|
||||||
|
AccountId uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add accountId to sharedWith access list for k8ci.
|
||||||
|
func (k K8CI) AccessAdd (ctx context.Context, req AccessAddRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/k8ci/accessAdd"
|
||||||
|
|
||||||
|
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(res), nil
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package k8ci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccessRemoveRequest struct for removing permission to access to account for a k8ci
|
||||||
|
type AccessRemoveRequest struct {
|
||||||
|
// ID of the K8 catalog item to remove access for
|
||||||
|
// Required: true
|
||||||
|
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
|
||||||
|
|
||||||
|
// Account ID to be removed from the sharedWith access list
|
||||||
|
// Required: true
|
||||||
|
AccountId uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove accountId from sharedWith access list for k8ci.
|
||||||
|
func (k K8CI) AccessRemove (ctx context.Context, req AccessRemoveRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/k8ci/accessRemove"
|
||||||
|
|
||||||
|
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(res), nil
|
||||||
|
}
|
Loading…
Reference in new issue