chore(API): Update the API definitions for RDP (#6758)

This commit is contained in:
Ryan Derr authored and GitHub committed 2026-07-08 16:42:34 +05:30
1 parent b495fe653b
commit 6f03523372
30 files changed
+4189 -268

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ const (
EnvBoundarySRVLookup = "BOUNDARY_SRV_LOOKUP"
AsciiCastMimeType = "application/x-asciicast"
VideoMimeType = "video/webm"
StreamChunkSize = 1024 * 64 // stream chuck buffer size
)
+11 -9
View File
@@ -11,13 +11,15 @@ import (
)
type ChannelRecording struct {
Id string `json:"id,omitempty"`
BytesUp uint64 `json:"bytes_up,string,omitempty"`
BytesDown uint64 `json:"bytes_down,string,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
StartTime time.Time `json:"start_time,omitempty"`
EndTime time.Time `json:"end_time,omitempty"`
Duration api.Duration `json:"duration,omitempty"`
MimeTypes []string `json:"mime_types,omitempty"`
Id string `json:"id,omitempty"`
BytesUp uint64 `json:"bytes_up,string,omitempty"`
BytesDown uint64 `json:"bytes_down,string,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
StartTime time.Time `json:"start_time,omitempty"`
EndTime time.Time `json:"end_time,omitempty"`
Duration api.Duration `json:"duration,omitempty"`
MimeTypes []string `json:"mime_types,omitempty"`
RecordingState *RecordingState `json:"recording_state,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
}
@@ -21,4 +21,7 @@ type ConnectionRecording struct {
Duration api.Duration `json:"duration,omitempty"`
MimeTypes []string `json:"mime_types,omitempty"`
ChannelRecordings []*ChannelRecording `json:"channel_recordings,omitempty"`
RecordingState *RecordingState `json:"recording_state,omitempty"`
Exports []*Export `json:"exports,omitempty"`
Videos []*Video `json:"videos,omitempty"`
}
+371 -4
View File
@@ -6,16 +6,19 @@ package sessionrecordings
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/url"
"slices"
"strconv"
"github.com/hashicorp/boundary/api"
)
// Download will of course download the request session recording resource.
// Currently it always requests a mime-type of asciicast.
// Download makes a Boundary request to download the requested session recording
// or media resource.
func (c *Client) Download(ctx context.Context, contentId string, opt ...Option) (io.ReadCloser, error) {
switch {
case contentId == "":
@@ -30,8 +33,13 @@ func (c *Client) Download(ctx context.Context, contentId string, opt ...Option)
if err != nil {
return nil, fmt.Errorf("error creating download request: %w", err)
}
opts.queryMap["mime_type"] = api.AsciiCastMimeType
req.Header.Set("Accept", api.AsciiCastMimeType)
mimeType, ok := opts.queryMap["mime_type"]
if !ok {
// Maintain backwards compatibility if mime-type isn't passed in.
opts.queryMap["mime_type"] = api.AsciiCastMimeType
mimeType = api.AsciiCastMimeType
}
req.Header.Set("Accept", mimeType)
if len(opts.queryMap) > 0 {
q := url.Values{}
@@ -99,3 +107,362 @@ func (c *Client) ReApplyStoragePolicy(ctx context.Context, contentId string, opt
target.Response = resp
return target, nil
}
// Export starts an export against a session recording connection.
func (c *Client) Export(ctx context.Context, connectionRecordingId, mimeType string, opt ...Option) (*ExportCreateResult, error) {
switch {
case connectionRecordingId == "":
return nil, fmt.Errorf("empty connectionRecordingId")
case mimeType == "":
return nil, fmt.Errorf("empty mimeType")
case c.client == nil:
return nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
opts.postMap["mime_type"] = mimeType
req, err := c.client.NewRequest(ctx, "POST", "session-recordings/"+url.PathEscape(connectionRecordingId)+":export", opts.postMap, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request: %w", err)
}
target := new(ExportCreateResult)
target.Item = new(Export)
apiErr, err := resp.Decode(target.Item)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
target.Response = resp
return target, nil
}
// ReadExport reads an export.
func (c *Client) ReadExport(ctx context.Context, exportId string, opt ...Option) (*ExportReadResult, error) {
switch {
case exportId == "":
return nil, fmt.Errorf("empty exportId")
case c.client == nil:
return nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "GET", "session-recordings/"+url.PathEscape(exportId)+":export", nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request: %w", err)
}
target := new(ExportReadResult)
target.Item = new(Export)
apiErr, err := resp.Decode(target.Item)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
target.Response = resp
return target, nil
}
// ListExports lists existing session recording exports.
func (c *Client) ListExports(ctx context.Context, scopeId string, opt ...Option) (*ExportListResult, error) {
switch {
case scopeId == "":
return nil, fmt.Errorf("empty scopeId")
case c.client == nil:
return nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
opts.queryMap["scope_id"] = scopeId
requestPath := "session-recordings:list-exports"
if opts.withResourcePathOverride != "" {
requestPath = opts.withResourcePathOverride
}
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request: %w", err)
}
target := new(ExportListResult)
apiErr, err := resp.Decode(target)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
target.Response = resp
if target.ResponseType == "complete" || target.ResponseType == "" {
return target, nil
}
// In case we shortcut out due to client directed pagination, ensure these
// are set.
target.recursive = opts.withRecursive
target.pageSize = opts.withPageSize
target.scopeId = scopeId
target.allRemovedIds = target.RemovedIds
if opts.withClientDirectedPagination {
return target, nil
}
allItems := make([]*Export, 0, target.EstItemCount)
allItems = append(allItems, target.Items...)
// If there are more results, automatically fetch the rest of the results.
// idToIndex keeps a map from the ID of an item to its index in target.Items.
// This is used to update updated items in-place and remove deleted items
// from the result after pagination is done.
idToIndex := map[string]int{}
for i, item := range allItems {
idToIndex[item.Id] = i
}
// If we're here there are more pages and the client does not want to
// paginate on their own; fetch them as this call returns all values.
currentPage := target
for {
nextPage, err := c.ListExportsNextPage(ctx, currentPage, opt...)
if err != nil {
return nil, fmt.Errorf("error getting next page: %w", err)
}
for _, item := range nextPage.Items {
if i, ok := idToIndex[item.Id]; ok {
// Item has already been seen at index i, update in-place
allItems[i] = item
} else {
allItems = append(allItems, item)
idToIndex[item.Id] = len(allItems) - 1
}
}
currentPage = nextPage
if currentPage.ResponseType == "complete" {
break
}
}
// The current page here is the final page of the results, that is, the
// response type is "complete"
// Remove items that were deleted since the end of the last iteration.
// If a SessionRecording has been updated and subsequently removed, we don't want
// it to appear both in the Items and RemovedIds, so we remove it from the Items.
for _, removedId := range currentPage.RemovedIds {
if i, ok := idToIndex[removedId]; ok {
// Remove the item at index i without preserving order
// https://github.com/golang/go/wiki/SliceTricks#delete-without-preserving-order
allItems[i] = allItems[len(allItems)-1]
allItems = allItems[:len(allItems)-1]
// Update the index of the previously last element
idToIndex[allItems[i].Id] = i
}
}
// Sort the results again since in-place updates and deletes
// may have shuffled items. We sort by created time descending
// (most recently created first), same as the API.
slices.SortFunc(allItems, func(i, j *Export) int {
return j.CreatedTime.Compare(i.CreatedTime)
})
// Since we paginated to the end, we can avoid confusion
// for the user by setting the estimated item count to the
// length of the items slice. If we don't set this here, it
// will equal the value returned in the last response, which is
// often much smaller than the total number returned.
currentPage.EstItemCount = uint(len(allItems))
// Set items to the full list we have collected here
currentPage.Items = allItems
// Set the returned value to the last page with calculated values
target = currentPage
// Finally, since we made at least 2 requests to the server to fulfill this
// function call, resp.Body and resp.Map will only contain the most recent response.
// Overwrite them with the true response.
target.Response.Body.Reset()
if err := json.NewEncoder(target.Response.Body).Encode(target); err != nil {
return nil, fmt.Errorf("error encoding final JSON list response: %w", err)
}
if err := json.Unmarshal(target.Response.Body.Bytes(), &target.Response.Map); err != nil {
return nil, fmt.Errorf("error encoding final map list response: %w", err)
}
// Note: the HTTP response body is consumed by resp.Decode in the loop,
// so it doesn't need to be updated (it will always be, and has always been, empty).
return target, nil
}
// ListExportsNextPage obtains the next page of an export listing process, given
// the current page.
func (c *Client) ListExportsNextPage(ctx context.Context, currentPage *ExportListResult, opt ...Option) (*ExportListResult, error) {
if currentPage == nil {
return nil, fmt.Errorf("empty currentPage")
}
if currentPage.scopeId == "" {
return nil, fmt.Errorf("empty scopeId")
}
if c.client == nil {
return nil, fmt.Errorf("nil client")
}
if currentPage.ResponseType == "complete" || currentPage.ResponseType == "" {
return nil, fmt.Errorf("no more pages available")
}
opts, apiOpts := getOpts(opt...)
opts.queryMap["scope_id"] = currentPage.scopeId
// Don't require them to re-specify recursive
if currentPage.recursive {
opts.queryMap["recursive"] = "true"
}
if currentPage.pageSize != 0 {
opts.queryMap["page_size"] = strconv.FormatUint(uint64(currentPage.pageSize), 10)
}
requestPath := "session-recordings:list-exports"
if opts.withResourcePathOverride != "" {
requestPath = opts.withResourcePathOverride
}
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
opts.queryMap["list_token"] = currentPage.ListToken
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request: %w", err)
}
nextPage := new(ExportListResult)
apiErr, err := resp.Decode(nextPage)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
// Ensure values are carried forward to the next call
nextPage.scopeId = currentPage.scopeId
nextPage.recursive = currentPage.recursive
nextPage.pageSize = currentPage.pageSize
// Cache the removed IDs from this page
nextPage.allRemovedIds = append(currentPage.allRemovedIds, nextPage.RemovedIds...)
// Set the response body to the current response
nextPage.Response = resp
// If we're done iterating, pull the full set of removed IDs into the last
// response
if nextPage.ResponseType == "complete" {
// Collect up the last values
nextPage.RemovedIds = nextPage.allRemovedIds
// For now, removedIds will only be populated if this pagination cycle
// was the result of a "refresh" operation (i.e., the caller provided a
// list token option to this call).
//
// Sort to make response deterministic
slices.Sort(nextPage.RemovedIds)
// Remove any duplicates
nextPage.RemovedIds = slices.Compact(nextPage.RemovedIds)
}
return nextPage, nil
}
// CancelExport cancels an existing export.
func (c *Client) CancelExport(ctx context.Context, exportId string, opt ...Option) (*ExportDeleteResult, error) {
switch {
case exportId == "":
return nil, fmt.Errorf("empty exportId")
case c.client == nil:
return nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "POST", "session-recordings/"+url.PathEscape(exportId)+":export:cancel", nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
}
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error performing client request: %w", err)
}
apiErr, err := resp.Decode(nil)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
if apiErr != nil {
return nil, apiErr
}
return &ExportDeleteResult{Response: resp}, nil
}
+95
View File
@@ -0,0 +1,95 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
import (
"time"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/scopes"
)
type Export struct {
Id string `json:"id,omitempty"`
Scope *scopes.ScopeInfo `json:"scope,omitempty"`
MimeType string `json:"mime_type,omitempty"`
State string `json:"state,omitempty"`
ProgressPercent uint32 `json:"progress_percent,omitempty"`
WorkerId string `json:"worker_id,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
Version uint32 `json:"version,omitempty"`
ConnectionRecordingId string `json:"connection_recording_id,omitempty"`
Error string `json:"error,omitempty"`
AuthorizedActions []string `json:"authorized_actions,omitempty"`
}
type ExportReadResult struct {
Item *Export
Response *api.Response
}
func (n ExportReadResult) GetItem() *Export {
return n.Item
}
func (n ExportReadResult) GetResponse() *api.Response {
return n.Response
}
type ExportCreateResult = ExportReadResult
type ExportDeleteResult struct {
Response *api.Response
}
// GetItem will always be nil for ExportDeleteResult
func (n ExportDeleteResult) GetItem() any {
return nil
}
func (n ExportDeleteResult) GetResponse() *api.Response {
return n.Response
}
type ExportListResult struct {
Items []*Export `json:"items,omitempty"`
EstItemCount uint `json:"est_item_count,omitempty"`
RemovedIds []string `json:"removed_ids,omitempty"`
ListToken string `json:"list_token,omitempty"`
ResponseType string `json:"response_type,omitempty"`
Response *api.Response
// The following fields are used for cached information when client-directed
// pagination is used.
recursive bool
pageSize uint32
scopeId string
allRemovedIds []string
}
func (n ExportListResult) GetItems() []*Export {
return n.Items
}
func (n ExportListResult) GetEstItemCount() uint {
return n.EstItemCount
}
func (n ExportListResult) GetRemovedIds() []string {
return n.RemovedIds
}
func (n ExportListResult) GetListToken() string {
return n.ListToken
}
func (n ExportListResult) GetResponseType() string {
return n.ResponseType
}
func (n ExportListResult) GetResponse() *api.Response {
return n.Response
}
+11
View File
@@ -30,6 +30,7 @@ type options struct {
withPageSize uint32
withResourcePathOverride string
withRecursive bool
withMimeType string
}
func getDefaultOptions() options {
@@ -62,6 +63,9 @@ func getOpts(opt ...Option) (options, []api.Option) {
if opts.withPageSize != 0 {
opts.queryMap["page_size"] = strconv.FormatUint(uint64(opts.withPageSize), 10)
}
if opts.withMimeType != "" {
opts.queryMap["mime_type"] = opts.withMimeType
}
return opts, apiOpts
}
@@ -110,3 +114,10 @@ func WithRecursive(recurse bool) Option {
o.withRecursive = recurse
}
}
// WithMimeType tells the API to set a specific mime-type on this request.
func WithMimeType(mimeType string) Option {
return func(o *options) {
o.withMimeType = mimeType
}
}
@@ -0,0 +1,41 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
import (
"fmt"
"github.com/mitchellh/mapstructure"
)
type RdpTargetAttributes struct {
DefaultPort uint32 `json:"default_port,omitempty"`
DefaultClientPort uint32 `json:"default_client_port,omitempty"`
}
func AttributesMapToRdpTargetAttributes(in map[string]any) (*RdpTargetAttributes, error) {
if in == nil {
return nil, fmt.Errorf("nil input map")
}
var out RdpTargetAttributes
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
Result: &out,
TagName: "json",
})
if err != nil {
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
}
if err := dec.Decode(in); err != nil {
return nil, fmt.Errorf("error decoding: %w", err)
}
return &out, nil
}
func (pt *Target) GetRdpTargetAttributes() (*RdpTargetAttributes, error) {
if pt.Type != "rdp" {
return nil, fmt.Errorf("asked to fetch %s-type attributes but target is of type %s", "rdp", pt.Type)
}
return AttributesMapToRdpTargetAttributes(pt.Attributes)
}
@@ -0,0 +1,11 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
type RecordingState struct {
StorageState string `json:"storage_state,omitempty"`
SyncingErrorDetails string `json:"syncing_error_details,omitempty"`
VerificationErrorDetails string `json:"verification_error_details,omitempty"`
}
@@ -39,6 +39,8 @@ type SessionRecording struct {
AuthorizedActions []string `json:"authorized_actions,omitempty"`
RetainUntil time.Time `json:"retain_until,omitempty"`
DeleteAfter time.Time `json:"delete_after,omitempty"`
Availability string `json:"availability,omitempty"`
RecordingState *RecordingState `json:"recording_state,omitempty"`
}
type SessionRecordingReadResult struct {
@@ -0,0 +1,42 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
import (
"fmt"
"github.com/mitchellh/mapstructure"
)
type UsernamePasswordDomainCredentialAttributes struct {
Username string `json:"username,omitempty"`
PasswordHmac string `json:"password_hmac,omitempty"`
Domain string `json:"domain,omitempty"`
}
func AttributesMapToUsernamePasswordDomainCredentialAttributes(in map[string]any) (*UsernamePasswordDomainCredentialAttributes, error) {
if in == nil {
return nil, fmt.Errorf("nil input map")
}
var out UsernamePasswordDomainCredentialAttributes
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
Result: &out,
TagName: "json",
})
if err != nil {
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
}
if err := dec.Decode(in); err != nil {
return nil, fmt.Errorf("error decoding: %w", err)
}
return &out, nil
}
func (pt *Credential) GetUsernamePasswordDomainCredentialAttributes() (*UsernamePasswordDomainCredentialAttributes, error) {
if pt.Type != "username_password_domain" {
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "username_password_domain", pt.Type)
}
return AttributesMapToUsernamePasswordDomainCredentialAttributes(pt.Attributes)
}
@@ -0,0 +1,40 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
import (
"fmt"
"github.com/mitchellh/mapstructure"
)
type VaultLdapCredentialLibraryAttributes struct {
Path string `json:"path,omitempty"`
}
func AttributesMapToVaultLdapCredentialLibraryAttributes(in map[string]any) (*VaultLdapCredentialLibraryAttributes, error) {
if in == nil {
return nil, fmt.Errorf("nil input map")
}
var out VaultLdapCredentialLibraryAttributes
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
Result: &out,
TagName: "json",
})
if err != nil {
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
}
if err := dec.Decode(in); err != nil {
return nil, fmt.Errorf("error decoding: %w", err)
}
return &out, nil
}
func (pt *CredentialLibrary) GetVaultLdapCredentialLibraryAttributes() (*VaultLdapCredentialLibraryAttributes, error) {
if pt.Type != "vault-ldap" {
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault-ldap", pt.Type)
}
return AttributesMapToVaultLdapCredentialLibraryAttributes(pt.Attributes)
}
+16
View File
@@ -0,0 +1,16 @@
// Code generated by "make api"; DO NOT EDIT.
// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: MPL-2.0
package sessionrecordings
import (
"time"
)
type Video struct {
Id string `json:"id,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
LengthSeconds uint64 `json:"length_seconds,string,omitempty"`
SizeBytes uint64 `json:"size_bytes,string,omitempty"`
}
+60
View File
@@ -341,6 +341,30 @@ func DefaultEgressWorkerFilter() Option {
}
}
func WithRdpTargetEnableSessionRecording(inEnableSessionRecording bool) Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
if !ok {
raw = any(map[string]any{})
}
val := raw.(map[string]any)
val["enable_session_recording"] = inEnableSessionRecording
o.postMap["attributes"] = val
}
}
func DefaultRdpTargetEnableSessionRecording() Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
if !ok {
raw = any(map[string]any{})
}
val := raw.(map[string]any)
val["enable_session_recording"] = nil
o.postMap["attributes"] = val
}
}
func WithSshTargetEnableSessionRecording(inEnableSessionRecording bool) Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
@@ -353,6 +377,18 @@ func WithSshTargetEnableSessionRecording(inEnableSessionRecording bool) Option {
}
}
func DefaultSshTargetEnableSessionRecording() Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
if !ok {
raw = any(map[string]any{})
}
val := raw.(map[string]any)
val["enable_session_recording"] = nil
o.postMap["attributes"] = val
}
}
func WithHostId(inHostId string) Option {
return func(o *options) {
o.postMap["host_id"] = inHostId
@@ -431,6 +467,30 @@ func DefaultSessionMaxSeconds() Option {
}
}
func WithRdpTargetStorageBucketId(inStorageBucketId string) Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
if !ok {
raw = any(map[string]any{})
}
val := raw.(map[string]any)
val["storage_bucket_id"] = inStorageBucketId
o.postMap["attributes"] = val
}
}
func DefaultRdpTargetStorageBucketId() Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
if !ok {
raw = any(map[string]any{})
}
val := raw.(map[string]any)
val["storage_bucket_id"] = nil
o.postMap["attributes"] = val
}
}
func WithSshTargetStorageBucketId(inStorageBucketId string) Option {
return func(o *options) {
raw, ok := o.postMap["attributes"]
+4 -2
View File
@@ -11,8 +11,10 @@ import (
)
type RdpTargetAttributes struct {
DefaultPort uint32 `json:"default_port,omitempty"`
DefaultClientPort uint32 `json:"default_client_port,omitempty"`
DefaultPort uint32 `json:"default_port,omitempty"`
DefaultClientPort uint32 `json:"default_client_port,omitempty"`
StorageBucketId string `json:"storage_bucket_id,omitempty"`
EnableSessionRecording bool `json:"enable_session_recording,omitempty"`
}
func AttributesMapToRdpTargetAttributes(in map[string]any) (*RdpTargetAttributes, error) {