putWebhook method
Defines a webhook and returns a unique webhook URL generated by CodePipeline. This URL can be supplied to third party source hosting providers to call every time there's a code change. When CodePipeline receives a POST request on this URL, the pipeline defined in the webhook is started as long as the POST request satisfied the authentication and filtering requirements supplied when defining the webhook. RegisterWebhookWithThirdParty and DeregisterWebhookWithThirdParty APIs can be used to automatically configure supported third parties to call the generated webhook URL.
May throw ValidationException. May throw LimitExceededException. May throw InvalidWebhookFilterPatternException. May throw InvalidWebhookAuthenticationParametersException. May throw PipelineNotFoundException. May throw TooManyTagsException. May throw InvalidTagsException. May throw ConcurrentModificationException.
Parameter webhook
:
The detail provided in an input file to create the webhook, such as the
webhook name, the pipeline name, and the action name. Give the webhook a
unique name that helps you identify it. You might name the webhook after
the pipeline and action it targets so that you can easily recognize what
it's used for later.
Parameter tags
:
The tags for the webhook.
Implementation
Future<PutWebhookOutput> putWebhook({
required WebhookDefinition webhook,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(webhook, 'webhook');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodePipeline_20150709.PutWebhook'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'webhook': webhook,
if (tags != null) 'tags': tags,
},
);
return PutWebhookOutput.fromJson(jsonResponse.body);
}