File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
packages/clients/src/api/instance/v1 Expand file tree Collapse file tree 2 files changed +30
-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+ SetServerUserDataRequest ,
4243 UpdateImageRequest ,
4344 UpdateImageResponse ,
4445 UpdateSecurityGroupRequest ,
@@ -510,4 +511,23 @@ export class InstanceV1UtilsAPI extends API {
510511 ) ,
511512 )
512513 . then ( res => ( { image : res . image } ) )
514+
515+ /**
516+ * Sets the content of a user data on a server for the given key.
517+ *
518+ * @param request - The request {@link SetServerUserDataRequest}
519+ */
520+ setServerUserData = ( request : Readonly < SetServerUserDataRequest > ) =>
521+ this . client . fetch < void > ( {
522+ body : request . content ,
523+ headers : { 'Content-Type' : 'text/plain' } ,
524+ method : 'PATCH' ,
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+ } )
513533}
Original file line number Diff line number Diff line change @@ -106,6 +106,16 @@ export interface UpdateImageResponse {
106106 image ?: Image
107107}
108108
109+ export type SetServerUserDataRequest = {
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 set */
114+ key : string
115+ /** The data encoded in base64 */
116+ content : string
117+ }
118+
109119export type {
110120 CreateServerRequest ,
111121 UpdateServerRequest ,
You can’t perform that action at this time.
0 commit comments