updateWorkspace method

Future<UpdateWorkspaceResponse> updateWorkspace({
  1. required String workspaceId,
  2. AccountAccessType? accountAccessType,
  3. IPAddressType? ipAddressType,
  4. NetworkAccessConfiguration? networkAccessControl,
  5. String? organizationRoleName,
  6. PermissionType? permissionType,
  7. bool? removeNetworkAccessConfiguration,
  8. bool? removeVpcConfiguration,
  9. String? stackSetName,
  10. VpcConfiguration? vpcConfiguration,
  11. List<DataSourceType>? workspaceDataSources,
  12. String? workspaceDescription,
  13. String? workspaceName,
  14. List<NotificationDestinationType>? workspaceNotificationDestinations,
  15. List<String>? workspaceOrganizationalUnits,
  16. String? workspaceRoleArn,
})

Modifies an existing Amazon Managed Grafana workspace. If you use this operation and omit any optional parameters, the existing values of those parameters are not changed.

To modify the user authentication methods that the workspace uses, such as SAML or IAM Identity Center, use UpdateWorkspaceAuthentication.

To modify which users in the workspace have the Admin and Editor Grafana roles, use UpdatePermissions.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter workspaceId : The ID of the workspace to update.

Parameter accountAccessType : Specifies whether the workspace can access Amazon Web Services resources in this Amazon Web Services account only, or whether it can also access Amazon Web Services resources in other accounts in the same organization. If you specify ORGANIZATION, you must specify which organizational units the workspace can access in the workspaceOrganizationalUnits parameter.

Parameter ipAddressType : Specifies whether the workspace supports IPv4 only, or IPv4 and IPv6. Valid values are IPv4 and DualStack. For more information about IP address types, see Network access control.

Parameter networkAccessControl : The configuration settings for network access to your workspace.

When this is configured, only listed IP addresses and VPC endpoints will be able to access your workspace. Standard Grafana authentication and authorization will still be required.

If this is not configured, or is removed, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.

Parameter organizationRoleName : The name of an IAM role that already exists to use to access resources through Organizations. This can only be used with a workspace that has the permissionType set to CUSTOMER_MANAGED.

Parameter permissionType : Use this parameter if you want to change a workspace from SERVICE_MANAGED to CUSTOMER_MANAGED. This allows you to manage the permissions that the workspace uses to access datasources and notification channels. If the workspace is in a member Amazon Web Services account of an organization, and that account is not a delegated administrator account, and you want the workspace to access data sources in other Amazon Web Services accounts in the organization, you must choose CUSTOMER_MANAGED.

If you specify this as CUSTOMER_MANAGED, you must also specify a workspaceRoleArn that the workspace will use for accessing Amazon Web Services resources.

For more information on the role and permissions needed, see Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels

You can convert a CUSTOMER_MANAGED workspace to SERVICE_MANAGED using the Amazon Managed Grafana console. For more information, see Managing permissions for data sources and notification channels.

Parameter removeNetworkAccessConfiguration : Whether to remove the network access configuration from the workspace.

Setting this to true and providing a networkAccessControl to set will return an error.

If you remove this configuration by setting this to true, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.

Parameter removeVpcConfiguration : Whether to remove the VPC configuration from the workspace.

Setting this to true and providing a vpcConfiguration to set will return an error.

Parameter stackSetName : The name of the CloudFormation stack set to use to generate IAM roles to be used for this workspace.

Parameter vpcConfiguration : The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to.

Parameter workspaceDataSources : This parameter is for internal use only, and should not be used.

Parameter workspaceDescription : A description for the workspace. This is used only to help you identify this workspace.

Parameter workspaceName : A new name for the workspace to update.

Parameter workspaceNotificationDestinations : Specify the Amazon Web Services notification channels that you plan to use in this workspace. Specifying these data sources here enables Amazon Managed Grafana to create IAM roles and permissions that allow Amazon Managed Grafana to use these channels.

Parameter workspaceOrganizationalUnits : Specifies the organizational units that this workspace is allowed to use data sources from, if this workspace is in an account that is part of an organization.

Parameter workspaceRoleArn : Specifies an IAM role that grants permissions to Amazon Web Services resources that the workspace accesses, such as data sources and notification channels. If this workspace has permissionType CUSTOMER_MANAGED, then this role is required.

Implementation

Future<UpdateWorkspaceResponse> updateWorkspace({
  required String workspaceId,
  AccountAccessType? accountAccessType,
  IPAddressType? ipAddressType,
  NetworkAccessConfiguration? networkAccessControl,
  String? organizationRoleName,
  PermissionType? permissionType,
  bool? removeNetworkAccessConfiguration,
  bool? removeVpcConfiguration,
  String? stackSetName,
  VpcConfiguration? vpcConfiguration,
  List<DataSourceType>? workspaceDataSources,
  String? workspaceDescription,
  String? workspaceName,
  List<NotificationDestinationType>? workspaceNotificationDestinations,
  List<String>? workspaceOrganizationalUnits,
  String? workspaceRoleArn,
}) async {
  final $payload = <String, dynamic>{
    if (accountAccessType != null)
      'accountAccessType': accountAccessType.value,
    if (ipAddressType != null) 'ipAddressType': ipAddressType.value,
    if (networkAccessControl != null)
      'networkAccessControl': networkAccessControl,
    if (organizationRoleName != null)
      'organizationRoleName': organizationRoleName,
    if (permissionType != null) 'permissionType': permissionType.value,
    if (removeNetworkAccessConfiguration != null)
      'removeNetworkAccessConfiguration': removeNetworkAccessConfiguration,
    if (removeVpcConfiguration != null)
      'removeVpcConfiguration': removeVpcConfiguration,
    if (stackSetName != null) 'stackSetName': stackSetName,
    if (vpcConfiguration != null) 'vpcConfiguration': vpcConfiguration,
    if (workspaceDataSources != null)
      'workspaceDataSources':
          workspaceDataSources.map((e) => e.value).toList(),
    if (workspaceDescription != null)
      'workspaceDescription': workspaceDescription,
    if (workspaceName != null) 'workspaceName': workspaceName,
    if (workspaceNotificationDestinations != null)
      'workspaceNotificationDestinations':
          workspaceNotificationDestinations.map((e) => e.value).toList(),
    if (workspaceOrganizationalUnits != null)
      'workspaceOrganizationalUnits': workspaceOrganizationalUnits,
    if (workspaceRoleArn != null) 'workspaceRoleArn': workspaceRoleArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/workspaces/${Uri.encodeComponent(workspaceId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateWorkspaceResponse.fromJson(response);
}