putModelPackageGroupPolicy method

Future<PutModelPackageGroupPolicyOutput> putModelPackageGroupPolicy({
  1. required String modelPackageGroupName,
  2. required String resourcePolicy,
})

Adds a resouce policy to control access to a model group. For information about resoure policies, see Identity-based policies and resource-based policies in the AWS Identity and Access Management User Guide..

Parameter modelPackageGroupName : The name of the model group to add a resource policy to.

Parameter resourcePolicy : The resource policy for the model group.

Implementation

Future<PutModelPackageGroupPolicyOutput> putModelPackageGroupPolicy({
  required String modelPackageGroupName,
  required String resourcePolicy,
}) async {
  ArgumentError.checkNotNull(modelPackageGroupName, 'modelPackageGroupName');
  _s.validateStringLength(
    'modelPackageGroupName',
    modelPackageGroupName,
    1,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourcePolicy, 'resourcePolicy');
  _s.validateStringLength(
    'resourcePolicy',
    resourcePolicy,
    1,
    20480,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.PutModelPackageGroupPolicy'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ModelPackageGroupName': modelPackageGroupName,
      'ResourcePolicy': resourcePolicy,
    },
  );

  return PutModelPackageGroupPolicyOutput.fromJson(jsonResponse.body);
}