You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
935 B
41 lines
935 B
|
1 month ago
|
package compute
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"encoding/json"
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||
|
|
)
|
||
|
|
|
||
|
|
// GuestAgentFeatureGetRequest struct to feature get guest agent
|
||
|
|
type GuestAgentFeatureGetRequest struct {
|
||
|
|
// ID of compute instance
|
||
|
|
// Required: true
|
||
|
|
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// List of features
|
||
|
|
func (c Compute) GuestAgentFeatureGet(ctx context.Context, req GuestAgentFeatureGetRequest) ([]string, error) {
|
||
|
|
err := validators.ValidateRequest(req)
|
||
|
|
if err != nil {
|
||
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||
|
|
}
|
||
|
|
|
||
|
|
url := "/cloudbroker/compute/guest_agent_feature_get"
|
||
|
|
|
||
|
|
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
features := make([]string, 0)
|
||
|
|
|
||
|
|
err = json.Unmarshal(res, &features)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
return features, nil
|
||
|
|
}
|