本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
自定义 WorkSpace 品牌
亚马逊 WorkSpaces 允许您使用 API 自定义登录页面的外观,包括您自己的品牌徽标、IT 支持信息、忘记密码链接和登录消息,从而为用户创建熟悉的 WorkSpaces 体验。 WorkSpace您的品牌将在用户的 WorkSpace 登录页面上显示给他们,而不是默认的 WorkSpaces 品牌。
支持以下客户端:
Windows
Linux
Android
MacOS
iOS
Web 访问
注意
WorkSpaces 自定义品牌目前在Amazon GovCloud (美国西部)地区不可用。
导入自定义品牌
要导入您的客户品牌自定义设置,请使用操作ImportClientBranding
,其中包括以下元素。有关更多信息,请参阅 ImportClientBranding API 参考。
重要
客户品牌属性是面向公众的。确保您不包含敏感信息。

-
支持链接
-
徽标
-
忘记密码链接
-
登录消息
自定义品牌元素 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
品牌元素 | 描述 | 要求和建议 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
支持链接 | 允许您指定支持电子邮件链接,供用户联系以寻求帮助 WorkSpaces。您可以使用该SupportEmail 属性或使用该SupportLink 属性提供指向您的支持页面的链接。 |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
徽标 | 允许您使用Logo 属性自定义组织的徽标。 |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
忘记密码链接 | 允许您使用用户忘记密码时可以访问的 ForgotPasswordLink 属性来添加网址 WorkSpace。 | 长度限制:最小长度为 1。最大长度为 200。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
登录消息 | 允许您使用登录屏幕上的LoginMessage 属性自定义消息。 |
|
以下是供使用的示例代码片段 ImportClientBranding。
Amazon命令行界面版本 2
警告
导入自定义品牌会覆盖您在该平台内使用自定义数据指定的属性。它还会使用默认的自定义品牌属性值覆盖您未指定的属性。您必须包括不想覆盖的任何属性的数据。
aws workspaces import-client-branding —cli-input-json file://~/Downloads/import-input.json —region us-west-2
导入 JSON 文件应与以下示例代码类似:
{ "ResourceId": "<directory-id>", "DeviceTypeOsx": { "Logo": "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAC0lEQVR42mNgQAcAABIAAeRVjecAAAAASUVORK5CYII=", "ForgotPasswordLink": "https://amazon.com/", "SupportLink": "https://amazon.com/", "LoginMessage": { "en_US": "Hello!!" } } }
以下示例 Java 代码片段将徽标图像转换为 base64 位二进制格式。
// Read image as BufferImage BufferedImage bi = ImageIO.read(new File("~/Downloads/logo.png")); // convert BufferedImage to byte[] ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bi, "png", baos); byte[] bytes = baos.toByteArray(); //convert byte[] to base64 format and print it String bytesBase64 = Base64.encodeBase64String(bytes); System.out.println(bytesBase64);
以下示例 Python 代码片段将徽标图像转换为 base64 位二进制格式。
# Read logo into 64bit based string with open("~/Downloads/logo.png", "rb") as imageFile: f = imageFile.read() base64String = base64.b64encode(f) print(base64String)
Java
警告
导入自定义品牌会覆盖您在该平台内使用自定义数据指定的属性。它还会使用默认的自定义品牌属性值覆盖您未指定的属性。您必须包括不想覆盖的任何属性的数据。
// Create WS Client WorkSpacesClient client = WorkSpacesClient.builder().build(); // Read image as BufferImage BufferedImage bi = ImageIO.read(new File("~/Downloads/logo.png")); // convert BufferedImage to byte[] ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bi, "png", baos); byte[] bytes = baos.toByteArray(); // Create import attributes for the plateform DefaultImportClientBrandingAttributes attributes = DefaultImportClientBrandingAttributes.builder() .logo(SdkBytes.fromByteArray(bytes)) .forgotPasswordLink("https://aws.amazon.com/") .supportLink("https://aws.amazon.com/") .build(); // Create import request ImportClientBrandingRequest request = ImportClientBrandingRequest.builder() .resourceId("<directory-id>") .deviceTypeOsx(attributes) .build(); // Call ImportClientBranding API ImportClientBrandingResponse response = client.importClientBranding(request);
Python
警告
导入自定义品牌会覆盖您在该平台内使用自定义数据指定的属性。它还会使用默认的自定义品牌属性值覆盖您未指定的属性。您必须包括不想覆盖的任何属性的数据。
import boto3 # Read logo into bytearray with open("~/Downloads/logo.png", "rb") as imageFile: f = imageFile.read() bytes = bytearray(f) # Create workspaces client client = boto3.client('workspaces') # Call import API response = client.import_client_branding( ResourceId='<directory-id>', DeviceTypeOsx={ 'Logo': bytes, 'SupportLink': 'https://aws.amazon.com/', 'ForgotPasswordLink': 'https://aws.amazon.com/', 'LoginMessage': { 'en_US': 'Hello!!' } } )
PowerShell
# This forces the latest version of Tools or newer. May want to just add a note incase the have the full awspowershell module #Requires -Modules @{ ModuleName="AWS.Tools.WorkSpaces"; ModuleVersion="4.1.56"} # Specify Image Path $imagePath = "~/Downloads/logo.png" # Create Byte Array from image file $imageByte = ([System.IO.File]::ReadAllBytes($imagePath)) # Call import API Import-WKSClientBranding -ResourceId <directory-id> ` -DeviceTypeLinux_LoginMessage @{en_US="Hello!!"} ` -DeviceTypeLinux_Logo $imageByte ` -DeviceTypeLinux_ForgotPasswordLink "https://aws.amazon.com/" ` -DeviceTypeLinux_SupportLink "https://aws.amazon.com/"
要预览登录页面,请启动 WorkSpaces 应用程序或 Web 登录页面。
注意
更改最多可能需要 1 分钟才能显示。
描述自定义品牌
要查看您当前的客户品牌自定义的详细信息,请使用操作DescribeCustomBranding
。以下是使用的示例脚本 DescribeClientBranding。有关更多信息,请参阅 DescribeClientBranding API 参考。
aws workspaces describe-client-branding \ -resource-id directory-id \ -region us-west-2
删除自定义品牌
要删除您的客户品牌自定义设置,请使用操作DeleteCustomBranding
。以下是使用的示例脚本 DeleteClientBranding。有关更多信息,请参阅 DeleteClientBranding API 参考。
aws workspaces delete-client-branding \ —resource-id d-92677ad933 \ —platforms DeviceTypeAndroid DeviceTypeIos \ —region us-west-2
注意
更改最多可能需要 1 分钟才能显示。