acceptPortfolioShare method

Future<void> acceptPortfolioShare({
  1. required String portfolioId,
  2. String? acceptLanguage,
  3. PortfolioShareType? portfolioShareType,
})

Accepts an offer to share the specified portfolio.

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

Parameter portfolioId : The portfolio identifier.

Parameter acceptLanguage : The language code.

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

Parameter portfolioShareType : The type of shared portfolios to accept. The default is to accept imported portfolios.

  • AWS_ORGANIZATIONS - Accept portfolios shared by the management account of your organization.
  • IMPORTED - Accept imported portfolios.
  • AWS_SERVICECATALOG - Not supported. (Throws ResourceNotFoundException.)
For example, aws servicecatalog accept-portfolio-share --portfolio-id "port-2qwzkwxt3y5fk" --portfolio-share-type AWS_ORGANIZATIONS

Implementation

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