associateProductWithPortfolio method

Future<void> associateProductWithPortfolio({
  1. required String portfolioId,
  2. required String productId,
  3. String? acceptLanguage,
  4. String? sourcePortfolioId,
})

Associates the specified product with the specified portfolio.

A delegated admin is authorized to invoke this command.

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

Parameter portfolioId : The portfolio identifier.

Parameter productId : The product identifier.

Parameter acceptLanguage : The language code.

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

Parameter sourcePortfolioId : The identifier of the source portfolio.

Implementation

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