File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
packages/clients/src/api/instance/v1 Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import type {
3939 CreateServerRequest ,
4040 DetachVolumeRequest ,
4141 DetachVolumeResponse ,
42+ GetServerUserDataRequest ,
4243 SetServerUserDataRequest ,
4344 UpdateImageRequest ,
4445 UpdateImageResponse ,
@@ -512,6 +513,24 @@ export class InstanceV1UtilsAPI extends API {
512513 )
513514 . then ( res => ( { image : res . image } ) )
514515
516+ /**
517+ * Get the content of a user data on a server for the given key.
518+ *
519+ * @param request - The request {@link GetServerUserDataRequest}
520+ * @returns The content of the key
521+ */
522+ getServerUserData = ( request : Readonly < GetServerUserDataRequest > ) =>
523+ this . client . fetch < string > ( {
524+ method : 'GET' ,
525+ path : `/instance/v1/zones/${ validatePathParam (
526+ 'zone' ,
527+ request . zone ?? this . client . settings . defaultZone ,
528+ ) } /servers/${ validatePathParam (
529+ 'serverId' ,
530+ request . serverId ,
531+ ) } /user_data/${ validatePathParam ( 'key' , request . key ) } `,
532+ } )
533+
515534 /**
516535 * Sets the content of a user data on a server for the given key.
517536 *
Original file line number Diff line number Diff line change @@ -106,6 +106,14 @@ export interface UpdateImageResponse {
106106 image ?: Image
107107}
108108
109+ export type GetServerUserDataRequest = {
110+ /** Zone to target. If none is passed will use default zone from the config */
111+ zone ?: Zone
112+ serverId : string
113+ /** The user data key to get */
114+ key : string
115+ }
116+
109117export type SetServerUserDataRequest = {
110118 /** Zone to target. If none is passed will use default zone from the config */
111119 zone ?: Zone
You can’t perform that action at this time.
0 commit comments