Creates a connection that can then be given to other Amazon Web Services services like CodePipeline so that it can access third-party code repositories. The connection is in pending status until the third-party connection handshake is completed from the console.
Parameters:
-
provider_type
(Optional[ProviderType], default:
None
)
–
The name of the external provider where your third-party code repository is configured.
-
connection_name
(ConnectionName)
–
The name of the connection to be created.
-
tags
(Optional[TagList], default:
None
)
–
The key-value pair to use when tagging the resource.
-
host_arn
(Optional[HostArn], default:
None
)
–
The Amazon Resource Name (ARN) of the host associated with the connection to be created.
Raises:
Source code in docs_src/capo_codestar_connections/_services/code_starconnections.py
| def create_connection(
self,
connection_name: "capo_codestar_connections.types.connection_name.ConnectionName",
*,
config_overrides: Optional[CodeStarconnectionsClientConfig] = None,
provider_type: Optional[
"capo_codestar_connections.types.provider_type.ProviderType"
] = None,
tags: Optional["capo_codestar_connections.types.tag_list.TagList"] = None,
host_arn: Optional["capo_codestar_connections.types.host_arn.HostArn"] = None,
) -> "capo_codestar_connections.types.create_connection_output.CreateConnectionOutput":
"""<p>Creates a connection that can then be given to other Amazon Web Services services like CodePipeline so that it can access third-party code repositories. The connection is in pending status until the third-party connection handshake is completed from the console.</p>
Args:
provider_type: <p>The name of the external provider where your third-party code repository is configured.</p>
connection_name: <p>The name of the connection to be created.</p>
tags: <p>The key-value pair to use when tagging the resource.</p>
host_arn: <p>The Amazon Resource Name (ARN) of the host associated with the connection to be created.</p>
Raises:
capo_codestar_connections.errors.limit_exceeded_exception.LimitExceededException: <p>Exceeded the maximum limit for connections.</p>
capo_codestar_connections.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource not found. Verify the connection resource ARN and try again.</p>
capo_codestar_connections.errors.resource_unavailable_exception.ResourceUnavailableException: <p>Resource not found. Verify the ARN for the host resource and try again.</p>
capo_codestar_connections.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_codestar_connections.types.create_connection_input.CreateConnectionInput]",
) -> OperationResponse[
"capo_codestar_connections.types.create_connection_output.CreateConnectionOutput"
]:
import capo_codestar_connections._operations.code_star_connections_20191201.create_connection
output, http_response = (
capo_codestar_connections._operations.code_star_connections_20191201.create_connection.create_connection(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateConnection")
)
input_: capo_codestar_connections.types.create_connection_input.CreateConnectionInput = {
"connection_name": connection_name
}
if provider_type is not None:
input_["provider_type"] = provider_type
if tags is not None:
input_["tags"] = tags
if host_arn is not None:
input_["host_arn"] = host_arn
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|