Skip to content

add_workload

add_workload(
    resource_group_name: ResourceGroupName,
    component_name: ComponentName,
    workload_configuration: WorkloadConfiguration,
    *,
    config_overrides: Optional[ApplicationInsightsClientConfig] = None,
) -> AddWorkloadResponse

Adds a workload to a component. Each component can have at most five workloads.

Parameters:

  • resource_group_name (ResourceGroupName) –

    The name of the resource group.

  • component_name (ComponentName) –

    The name of the component.

  • workload_configuration (WorkloadConfiguration) –

    The configuration settings of the workload. The value is the escaped JSON of the configuration.

Raises:

Source code in docs_src/capo_application_insights/_services/application_insights.py
def add_workload(
    self,
    resource_group_name: "capo_application_insights.types.resource_group_name.ResourceGroupName",
    component_name: "capo_application_insights.types.component_name.ComponentName",
    workload_configuration: "capo_application_insights.types.workload_configuration.WorkloadConfiguration",
    *,
    config_overrides: Optional[ApplicationInsightsClientConfig] = None,
) -> "capo_application_insights.types.add_workload_response.AddWorkloadResponse":
    """<p>Adds a workload to a component. Each component can have at most five workloads.</p>

    Args:
        resource_group_name: <p>The name of the resource group.</p>
        component_name: <p>The name of the component.</p>
        workload_configuration: <p>The configuration settings of the workload. The value is the escaped JSON of the configuration.</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.
    """

    def _handler(
        req: "OperationRequest[capo_application_insights.types.add_workload_request.AddWorkloadRequest]",
    ) -> OperationResponse[
        "capo_application_insights.types.add_workload_response.AddWorkloadResponse"
    ]:
        import capo_application_insights._operations.ec2_windows_barley_service.add_workload

        output, http_response = (
            capo_application_insights._operations.ec2_windows_barley_service.add_workload.add_workload(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddWorkload")
    )
    input_: capo_application_insights.types.add_workload_request.AddWorkloadRequest = {
        "resource_group_name": resource_group_name,
        "component_name": component_name,
        "workload_configuration": workload_configuration,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output