putResourceConfig method

Future<void> putResourceConfig({
  1. required String configuration,
  2. required String resourceId,
  3. required String resourceType,
  4. required String schemaVersionId,
  5. String? resourceName,
  6. Map<String, String>? tags,
})

Records the configuration state for the resource provided in the request. The configuration state of a resource is represented in AWS Config as Configuration Items. Once this API records the configuration item, you can retrieve the list of configuration items for the custom resource type using existing AWS Config APIs.

When you call this API, AWS Config only stores configuration state of the resource provided in the request. This API does not change or remediate the configuration of the resource.

Write-only schema properites are not recorded as part of the published configuration item.

May throw ValidationException. May throw InsufficientPermissionsException. May throw NoRunningConfigurationRecorderException. May throw MaxActiveResourcesExceededException.

Parameter configuration : The configuration object of the resource in valid JSON format. It must match the schema registered with AWS CloudFormation.

Parameter resourceId : Unique identifier of the resource.

Parameter resourceType : The type of the resource. The custom resource type must be registered with AWS CloudFormation.

Parameter schemaVersionId : Version of the schema registered for the ResourceType in AWS CloudFormation.

Parameter resourceName : Name of the resource.

Parameter tags : Tags associated with the resource.

Implementation

Future<void> putResourceConfig({
  required String configuration,
  required String resourceId,
  required String resourceType,
  required String schemaVersionId,
  String? resourceName,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(configuration, 'configuration');
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    768,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  _s.validateStringLength(
    'resourceType',
    resourceType,
    1,
    196,
    isRequired: true,
  );
  ArgumentError.checkNotNull(schemaVersionId, 'schemaVersionId');
  _s.validateStringLength(
    'schemaVersionId',
    schemaVersionId,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.PutResourceConfig'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Configuration': configuration,
      'ResourceId': resourceId,
      'ResourceType': resourceType,
      'SchemaVersionId': schemaVersionId,
      if (resourceName != null) 'ResourceName': resourceName,
      if (tags != null) 'Tags': tags,
    },
  );
}