Skip to content

create_network async

create_network(
    network_name: GenericString,
    access_level: AccessLevel,
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    enable_premium_free_trial: Optional[bool] = None,
    encryption_key_arn: Optional[GenericString] = None,
) -> CreateNetworkResponse

Creates a new Wickr network with specified access level and configuration. This operation provisions a new communication network for your organization.

Parameters:

  • network_name (GenericString) –

    The name for the new network. Must be between 1 and 20 characters.

  • access_level (AccessLevel) –

    The access level for the network. Valid values are STANDARD or PREMIUM, which determine the features and capabilities available to network members.

  • enable_premium_free_trial (Optional[bool], default: None ) –

    Specifies whether to enable a premium free trial for the network. It is optional and has a default value as false. When set to true, the network starts with premium features for a limited trial period.

  • encryption_key_arn (Optional[GenericString], default: None ) –

    The ARN of the Amazon Web Services KMS customer managed key to use for encrypting sensitive data in the network.

Raises:

  • BadRequestError –

    The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.

  • ForbiddenError –

    Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.

  • InternalServerError –

    An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.

  • RateLimitError –

    The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.

  • ResourceNotFoundError –

    The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.

  • UnauthorizedError –

    The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.

  • ValidationError –

    One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Create network successfully

>>> await client.create_network(network_name='Production Network', access_level='PREMIUM', enable_premium_free_trial=False)
Create network with free trial
>>> await client.create_network(network_name='Trial Network', access_level='PREMIUM', enable_premium_free_trial=True)
Create network - invalid name
>>> await client.create_network(network_name='This network name is way too long', access_level='STANDARD')
Source code in docs_src/capo_wickr/_services/async_wickr.py
async def create_network(
    self,
    network_name: "capo_wickr.types.generic_string.GenericString",
    access_level: "capo_wickr.types.access_level.AccessLevel",
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    enable_premium_free_trial: Optional[bool] = None,
    encryption_key_arn: Optional[
        "capo_wickr.types.generic_string.GenericString"
    ] = None,
) -> "capo_wickr.types.create_network_response.CreateNetworkResponse":
    """<p>Creates a new Wickr network with specified access level and configuration. This operation provisions a new communication network for your organization.</p>

    Args:
        network_name: <p>The name for the new network. Must be between 1 and 20 characters.</p>
        access_level: <p>The access level for the network. Valid values are STANDARD or PREMIUM, which determine the features and capabilities available to network members.</p>
        enable_premium_free_trial: <p>Specifies whether to enable a premium free trial for the network. It is optional and has a default value as false. When set to true, the network starts with premium features for a limited trial period. </p>
        encryption_key_arn: <p>The ARN of the Amazon Web Services KMS customer managed key to use for encrypting sensitive data in the network.</p>

    Raises:
        capo_wickr.errors.bad_request_error.BadRequestError: <p>The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.</p>
        capo_wickr.errors.forbidden_error.ForbiddenError: <p>Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.</p>
        capo_wickr.errors.internal_server_error.InternalServerError: <p>An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.</p>
        capo_wickr.errors.rate_limit_error.RateLimitError: <p>The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.</p>
        capo_wickr.errors.resource_not_found_error.ResourceNotFoundError: <p>The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.</p>
        capo_wickr.errors.unauthorized_error.UnauthorizedError: <p>The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.</p>
        capo_wickr.errors.validation_error.ValidationError: <p>One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.</p>
        capo_wickr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create network successfully

        >>> await client.create_network(network_name='Production Network', access_level='PREMIUM', enable_premium_free_trial=False)
        Create network with free trial

        >>> await client.create_network(network_name='Trial Network', access_level='PREMIUM', enable_premium_free_trial=True)
        Create network - invalid name

        >>> await client.create_network(network_name='This network name is way too long', access_level='STANDARD')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_wickr.types.create_network_request.CreateNetworkRequest]",
    ) -> AsyncOperationResponse[
        "capo_wickr.types.create_network_response.CreateNetworkResponse"
    ]:
        import capo_wickr._operations.wickr_admin_api.create_network

        (
            output,
            http_response,
        ) = await capo_wickr._operations.wickr_admin_api.create_network.async_create_network(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateNetwork")
    )
    input_: capo_wickr.types.create_network_request.CreateNetworkRequest = {
        "network_name": network_name,
        "access_level": access_level,
    }
    if enable_premium_free_trial is not None:
        input_["enable_premium_free_trial"] = enable_premium_free_trial
    if encryption_key_arn is not None:
        input_["encryption_key_arn"] = encryption_key_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output