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

+53
View File
@@ -107,6 +107,10 @@ type structInfo struct {
// fields.
versionEnabled bool
// mimeTypeEnabled indicates that we should build a WithMimeType API option
// for this resource.
mimeTypeEnabled bool
// This is used for building the api path.
pluralResourceName string
@@ -1273,6 +1277,15 @@ var inputStructs = []*structInfo{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.RdpTargetAttributes{},
outFile: "sessionrecordings/rdp_target_attributes.gen.go",
subtypeName: "Rdp",
parentTypeName: "Target",
templates: []*template.Template{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.Host{},
outFile: "sessionrecordings/host.gen.go",
@@ -1312,6 +1325,15 @@ var inputStructs = []*structInfo{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.UsernamePasswordDomainCredentialAttributes{},
outFile: "sessionrecordings/username_password_domain_credential_attributes.gen.go",
subtype: "username_password_domain",
parentTypeName: "Credential",
templates: []*template.Template{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.JsonCredentialAttributes{},
outFile: "sessionrecordings/json_credential_attributes.gen.go",
@@ -1362,6 +1384,15 @@ var inputStructs = []*structInfo{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.VaultLdapCredentialLibraryAttributes{},
outFile: "sessionrecordings/vault_ldap_credential_library_attributes.gen.go",
subtype: "vault-ldap",
parentTypeName: "CredentialLibrary",
templates: []*template.Template{
mapstructureConversionTemplate,
},
},
{
inProto: &session_recordings.CredentialStore{},
outFile: "sessionrecordings/credential_store.gen.go",
@@ -1379,6 +1410,10 @@ var inputStructs = []*structInfo{
inProto: &session_recordings.ValuesAtTime{},
outFile: "sessionrecordings/values_at_time.gen.go",
},
{
inProto: &session_recordings.RecordingState{},
outFile: "sessionrecordings/recording_state.gen.go",
},
{
inProto: &session_recordings.ConnectionRecording{},
outFile: "sessionrecordings/connection_recording.gen.go",
@@ -1401,6 +1436,23 @@ var inputStructs = []*structInfo{
{Name: "BytesDown", JsonTags: []string{"string"}},
},
},
{
inProto: &session_recordings.Export{},
outFile: "sessionrecordings/export.gen.go",
pluralResourceName: "exports",
createResponseTypes: []string{CreateResponseType, ReadResponseType, ListResponseType, DeleteResponseType}, // DeleteResponseType is used for cancel.
},
{
inProto: &session_recordings.Video{},
outFile: "sessionrecordings/video.gen.go",
fieldOverrides: []fieldInfo{
// int64 fields get marshalled by protobuf as strings, so we have
// to tell the json parser that their json representation is a
// string but they go into Go int64 types.
{Name: "LengthSeconds", JsonTags: []string{"string"}},
{Name: "SizeBytes", JsonTags: []string{"string"}},
},
},
{
// this must be the last block of session recording blocks, otherwise
// the bits beyond inProto and outFile will get overwritten by
@@ -1418,6 +1470,7 @@ var inputStructs = []*structInfo{
recursiveListing: true,
skipListFiltering: true,
versionEnabled: false,
mimeTypeEnabled: true,
fieldOverrides: []fieldInfo{
// int64 fields get marshalled by protobuf as strings, so we have
// to tell the json parser that their json representation is a
+16 -1
View File
@@ -49,6 +49,7 @@ type templateInput struct {
SliceSubtypes map[string]sliceSubtypeInfo
ExtraFields []fieldInfo
VersionEnabled bool
MimeTypeEnabled bool
NonPaginatedListing bool
CreateResponseTypes []string
SkipListFiltering bool
@@ -70,6 +71,7 @@ func fillTemplates() {
ParentTypeName: in.parentTypeName,
ExtraFields: in.extraFields,
VersionEnabled: in.versionEnabled,
MimeTypeEnabled: in.mimeTypeEnabled,
NonPaginatedListing: in.nonPaginatedListing,
CreateResponseTypes: in.createResponseTypes,
SkipListFiltering: in.skipListFiltering,
@@ -204,6 +206,7 @@ func fillTemplates() {
SkipListFiltering: inputMap[pkg].skipListFiltering,
RecursiveListing: inputMap[pkg].recursiveListing,
VersionEnabled: inputMap[pkg].versionEnabled,
MimeTypeEnabled: inputMap[pkg].mimeTypeEnabled,
}
if err := optionTemplate.Execute(outBuf, input); err != nil {
@@ -955,6 +958,7 @@ type options struct {
withPageSize uint32
withResourcePathOverride string
{{ if .RecursiveListing }} withRecursive bool {{ end }}
{{ if .MimeTypeEnabled }} withMimeType string {{ end }}
}
func getDefaultOptions() options {
@@ -986,7 +990,10 @@ func getOpts(opt ...Option) (options, []api.Option) {
} {{ end }}
if opts.withPageSize != 0 {
opts.queryMap["page_size"] = strconv.FormatUint(uint64(opts.withPageSize), 10)
}
}{{ if .MimeTypeEnabled }}
if opts.withMimeType != "" {
opts.queryMap["mime_type"] = opts.withMimeType
} {{ end }}
return opts, apiOpts
}
@@ -1058,6 +1065,14 @@ func WithRecursive(recurse bool) Option {
}
}
{{ end }}
{{ if .MimeTypeEnabled }}
// 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
}
}
{{ end }}
{{ range $fieldIndex, $field := .Fields }}
{{ $subtypes := (removeDups $field.SubtypeNames ) }}
{{ if ( eq ( len ( $subtypes ) ) 0 )}}