async def create_log_pattern(
self,
resource_group_name: "capo_application_insights.types.resource_group_name.ResourceGroupName",
pattern_set_name: "capo_application_insights.types.log_pattern_set_name.LogPatternSetName",
pattern_name: "capo_application_insights.types.log_pattern_name.LogPatternName",
pattern: "capo_application_insights.types.log_pattern_regex.LogPatternRegex",
rank: "capo_application_insights.types.log_pattern_rank.LogPatternRank",
*,
config_overrides: Optional[AsyncApplicationInsightsClientConfig] = None,
) -> "capo_application_insights.types.create_log_pattern_response.CreateLogPatternResponse":
"""<p>Adds an log pattern to a <code>LogPatternSet</code>.</p>
Args:
resource_group_name: <p>The name of the resource group.</p>
pattern_set_name: <p>The name of the log pattern set.</p>
pattern_name: <p>The name of the log pattern.</p>
pattern: <p>The log pattern. The pattern must be DFA compatible. Patterns that utilize forward lookahead or backreference constructions are not supported.</p>
rank: <p>Rank of the log pattern. Must be a value between <code>1</code> and <code>1,000,000</code>. The patterns are sorted by rank, so we recommend that you set your highest priority patterns with the lowest rank. A pattern of rank <code>1</code> will be the first to get matched to a log line. A pattern of rank <code>1,000,000</code> will be last to get matched. When you configure custom log patterns from the console, a <code>Low</code> severity pattern translates to a <code>750,000</code> rank. A <code>Medium</code> severity pattern translates to a <code>500,000</code> rank. And a <code>High</code> severity pattern translates to a <code>250,000</code> rank. Rank values less than <code>1</code> or greater than <code>1,000,000</code> are reserved for Amazon Web Services provided patterns. </p>
Raises:
capo_application_insights.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
capo_application_insights.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is already created or in use.</p>
capo_application_insights.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource does not exist in the customer account.</p>
capo_application_insights.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
capo_application_insights.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_application_insights.types.create_log_pattern_request.CreateLogPatternRequest]",
) -> AsyncOperationResponse[
"capo_application_insights.types.create_log_pattern_response.CreateLogPatternResponse"
]:
if req.options.protocol == "awsJson1_1":
import capo_application_insights._operations.ec2_windows_barley_service.aws_json1_1.create_log_pattern
(
output,
http_response,
) = await capo_application_insights._operations.ec2_windows_barley_service.aws_json1_1.create_log_pattern.async_create_log_pattern(
req.options, req.input
)
elif req.options.protocol == "rpcv2Cbor":
import capo_application_insights._operations.ec2_windows_barley_service.rpcv2_cbor.create_log_pattern
(
output,
http_response,
) = await capo_application_insights._operations.ec2_windows_barley_service.rpcv2_cbor.create_log_pattern.async_create_log_pattern(
req.options, req.input
)
else:
raise ValueError(f"unknown protocol {req.options.protocol!r}")
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateLogPattern")
)
input_: capo_application_insights.types.create_log_pattern_request.CreateLogPatternRequest = {
"resource_group_name": resource_group_name,
"pattern_set_name": pattern_set_name,
"pattern_name": pattern_name,
"pattern": pattern,
"rank": rank,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output