createPortal method

Future<CreatePortalResponse> createPortal({
  1. required String portalContactEmail,
  2. required String portalName,
  3. required String roleArn,
  4. Alarms? alarms,
  5. String? clientToken,
  6. String? notificationSenderEmail,
  7. AuthMode? portalAuthMode,
  8. String? portalDescription,
  9. ImageFile? portalLogoImageFile,
  10. PortalType? portalType,
  11. Map<String, PortalTypeEntry>? portalTypeConfiguration,
  12. Map<String, String>? tags,
})
Creates a portal, which can contain projects and dashboards. IoT SiteWise Monitor uses IAM Identity Center or IAM to authenticate portal users and manage user permissions.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter portalContactEmail : The Amazon Web Services administrator's contact email address.

Parameter portalName : A friendly name for the portal.

Parameter roleArn : The ARN of a service role that allows the portal's users to access your IoT SiteWise resources on your behalf. For more information, see Using service roles for IoT SiteWise Monitor in the IoT SiteWise User Guide.

Parameter alarms : Contains the configuration information of an alarm created in an IoT SiteWise Monitor portal. You can use the alarm to monitor an asset property and get notified when the asset property value is outside a specified range. For more information, see Monitoring with alarms in the IoT SiteWise Application Guide.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter notificationSenderEmail : The email address that sends alarm notifications.

Parameter portalAuthMode : The service to use to authenticate users to the portal. Choose from the following options:

  • SSO – The portal uses IAM Identity Center to authenticate users and manage user permissions. Before you can create a portal that uses IAM Identity Center, you must enable IAM Identity Center. For more information, see Enabling IAM Identity Center in the IoT SiteWise User Guide. This option is only available in Amazon Web Services Regions other than the China Regions.
  • IAM – The portal uses Identity and Access Management to authenticate users and manage user permissions.
You can't change this value after you create a portal.

Default: SSO

Parameter portalDescription : A description for the portal.

Parameter portalLogoImageFile : A logo image to display in the portal. Upload a square, high-resolution image. The image is displayed on a dark background.

Parameter portalType : Define the type of portal. The value for IoT SiteWise Monitor (Classic) is SITEWISE_PORTAL_V1. The value for IoT SiteWise Monitor (AI-aware) is SITEWISE_PORTAL_V2.

Parameter portalTypeConfiguration : The configuration entry associated with the specific portal type. The value for IoT SiteWise Monitor (Classic) is SITEWISE_PORTAL_V1. The value for IoT SiteWise Monitor (AI-aware) is SITEWISE_PORTAL_V2.

Parameter tags : A list of key-value pairs that contain metadata for the portal. For more information, see Tagging your IoT SiteWise resources in the IoT SiteWise User Guide.

Implementation

Future<CreatePortalResponse> createPortal({
  required String portalContactEmail,
  required String portalName,
  required String roleArn,
  Alarms? alarms,
  String? clientToken,
  String? notificationSenderEmail,
  AuthMode? portalAuthMode,
  String? portalDescription,
  ImageFile? portalLogoImageFile,
  PortalType? portalType,
  Map<String, PortalTypeEntry>? portalTypeConfiguration,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'portalContactEmail': portalContactEmail,
    'portalName': portalName,
    'roleArn': roleArn,
    if (alarms != null) 'alarms': alarms,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (notificationSenderEmail != null)
      'notificationSenderEmail': notificationSenderEmail,
    if (portalAuthMode != null) 'portalAuthMode': portalAuthMode.value,
    if (portalDescription != null) 'portalDescription': portalDescription,
    if (portalLogoImageFile != null)
      'portalLogoImageFile': portalLogoImageFile,
    if (portalType != null) 'portalType': portalType.value,
    if (portalTypeConfiguration != null)
      'portalTypeConfiguration': portalTypeConfiguration,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/portals',
    hostPrefix: 'monitor.',
    exceptionFnMap: _exceptionFns,
  );
  return CreatePortalResponse.fromJson(response);
}