createAppBlock method

Future<CreateAppBlockResult> createAppBlock({
  1. required String name,
  2. required S3Location sourceS3Location,
  3. String? description,
  4. String? displayName,
  5. PackagingType? packagingType,
  6. ScriptDetails? postSetupScriptDetails,
  7. ScriptDetails? setupScriptDetails,
  8. Map<String, String>? tags,
})

Creates an app block.

App blocks are a WorkSpaces Applications resource that stores the details about the virtual hard disk in an S3 bucket. It also stores the setup script with details about how to mount the virtual hard disk. The virtual hard disk includes the application binaries and other files necessary to launch your applications. Multiple applications can be assigned to a single app block.

This is only supported for Elastic fleets.

May throw ConcurrentModificationException. May throw LimitExceededException. May throw OperationNotPermittedException. May throw ResourceAlreadyExistsException.

Parameter name : The name of the app block.

Parameter sourceS3Location : The source S3 location of the app block.

Parameter description : The description of the app block.

Parameter displayName : The display name of the app block. This is not displayed to the user.

Parameter packagingType : The packaging type of the app block.

Parameter postSetupScriptDetails : The post setup script details of the app block. This can only be provided for the APPSTREAM2 PackagingType.

Parameter setupScriptDetails : The setup script details of the app block. This must be provided for the CUSTOM PackagingType.

Parameter tags : The tags assigned to the app block.

Implementation

Future<CreateAppBlockResult> createAppBlock({
  required String name,
  required S3Location sourceS3Location,
  String? description,
  String? displayName,
  PackagingType? packagingType,
  ScriptDetails? postSetupScriptDetails,
  ScriptDetails? setupScriptDetails,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'PhotonAdminProxyService.CreateAppBlock'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'SourceS3Location': sourceS3Location,
      if (description != null) 'Description': description,
      if (displayName != null) 'DisplayName': displayName,
      if (packagingType != null) 'PackagingType': packagingType.value,
      if (postSetupScriptDetails != null)
        'PostSetupScriptDetails': postSetupScriptDetails,
      if (setupScriptDetails != null)
        'SetupScriptDetails': setupScriptDetails,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateAppBlockResult.fromJson(jsonResponse.body);
}