associatePrincipalWithPortfolio method

Future<void> associatePrincipalWithPortfolio({
  1. required String portfolioId,
  2. required String principalARN,
  3. required PrincipalType principalType,
  4. String? acceptLanguage,
})

Associates the specified principal ARN with the specified portfolio.

May throw InvalidParametersException. May throw ResourceNotFoundException. May throw LimitExceededException.

Parameter portfolioId : The portfolio identifier.

Parameter principalARN : The ARN of the principal (IAM user, role, or group).

Parameter principalType : The principal type. The supported value is IAM.

Parameter acceptLanguage : The language code.

  • en - English (default)
  • jp - Japanese
  • zh - Chinese

Implementation

Future<void> associatePrincipalWithPortfolio({
  required String portfolioId,
  required String principalARN,
  required PrincipalType principalType,
  String? acceptLanguage,
}) async {
  ArgumentError.checkNotNull(portfolioId, 'portfolioId');
  _s.validateStringLength(
    'portfolioId',
    portfolioId,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(principalARN, 'principalARN');
  _s.validateStringLength(
    'principalARN',
    principalARN,
    1,
    1000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(principalType, 'principalType');
  _s.validateStringLength(
    'acceptLanguage',
    acceptLanguage,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWS242ServiceCatalogService.AssociatePrincipalWithPortfolio'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PortfolioId': portfolioId,
      'PrincipalARN': principalARN,
      'PrincipalType': principalType.toValue(),
      if (acceptLanguage != null) 'AcceptLanguage': acceptLanguage,
    },
  );
}