Class: AWSClientPlugin
Extra-Helpers.AWSClientPlugin
AWSClientPlugin
Provides fetch
function that performs a fetch request with AWS v4 signing.
This is useful for connecting to AWS services like S3 directly from the client.
It also interfaces with the FileTransferPlugin to directly upload file when exported with the viewer or the plugin.
Note: Make sure to use keys with limited privileges and correct CORS settings.
All the keys will be stored in plain text in the vjson/glb when saved if serializeSettings
is set to true
Hierarchy
AViewerPlugin
<"fileUpload"
>↳
AWSClientPlugin
Properties
PluginType
▪ Static
Readonly
PluginType: "AWSClientPlugin1"
USE_PROXY
▪ Static
USE_PROXY: boolean
= false
Set to true to use a proxy for all requests.
This can be used to move the access credentials to the server side.
This is required for some services like cloudflare R2 that do not support CORS.
usage: AWSClientPlugin.USE_PROXY = true
, optionally set AWSClientPlugin.PROXY_URL
to a custom proxy.
PROXY_URL
▪ Static
PROXY_URL: string
= 'https://r2-s3-api.repalash.com/{path}'
uiConfig
• Optional
uiConfig: UiObjectConfig
<any
, string
>
enabled
• enabled: boolean
= true
Overrides
dependencies
• dependencies: typeof FileTransferPlugin
[]
accessKeyId
• accessKeyId: string
= ''
accessKeySecret
• accessKeySecret: string
= ''
endpointURL
• endpointURL: string
= ''
pathPrefix
• pathPrefix: string
= 'webgi'
serializeSettings
• serializeSettings: boolean
= false
serializeWithViewer
• Readonly
serializeWithViewer: false
fetchFunction
• fetchFunction: (input
: RequestInfo
, init?
: RequestInit
) => Promise
<Response
> = fetch
Type declaration
▸ (input
, init?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
input | RequestInfo |
init? | RequestInit |
Returns
Promise
<Response
>
_dirty
• Protected
_dirty: boolean
= false
Inherited from
_viewer
• Protected
Optional
_viewer: ViewerApp
Inherited from
Accessors
dirty
• get
dirty(): boolean
Returns
boolean
Inherited from
AViewerPlugin.dirty
• set
dirty(value
): void
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Inherited from
AViewerPlugin.dirty
viewer
• get
viewer(): undefined
| ViewerApp
Returns
undefined
| ViewerApp
Inherited from
AViewerPlugin.viewer
connected
• get
connected(): boolean
Returns
boolean
client
• get
client(): undefined
| AwsClient
Returns
undefined
| AwsClient
Methods
onDispose
▸ onDispose(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Inherited from
onRemove
▸ onRemove(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Inherited from
fromJSON
▸ fromJSON(data
, meta?
): null
| AWSClientPlugin
| Promise
<null
| AWSClientPlugin
>
Parameters
Name | Type |
---|---|
data | any |
meta? | any |
Returns
null
| AWSClientPlugin
| Promise
<null
| AWSClientPlugin
>
Inherited from
exportState
▸ exportState(): any
Returns
any
Inherited from
importState
▸ importState(state
): Promise
<void
>
Parameters
Name | Type |
---|---|
state | any |
Returns
Promise
<void
>
Inherited from
storeState
▸ storeState(prefix?
, storage?
, data?
): void
Parameters
Name | Type |
---|---|
prefix? | string |
storage? | Storage |
data? | any |
Returns
void
Inherited from
loadState
▸ loadState(prefix?
, storage?
): Promise
<void
>
Parameters
Name | Type |
---|---|
prefix? | string |
storage? | Storage |
Returns
Promise
<void
>
Inherited from
toggleConnection
▸ toggleConnection(): void
Returns
void
connect
▸ connect(): void
Returns
void
refreshUi
▸ refreshUi(): void
Returns
void
disconnect
▸ disconnect(): void
Returns
void
toJSON
▸ toJSON(meta?
): any
Parameters
Name | Type |
---|---|
meta? | any |
Returns
any
Overrides
onAdded
▸ onAdded(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Overrides
fetch
▸ fetch(input
, init
, onProgress?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
input | RequestInfo |
init | RequestInit |
onProgress? | (d : { state? : string ; progress? : number }) => void |
Returns
Promise
<Response
>
_storeKey
▸ Protected
_storeKey(prefix?
): string
Parameters
Name | Type |
---|---|
prefix? | string |
Returns
string
Inherited from
Constructors
constructor
• new AWSClientPlugin()