Server Test Python

Server Test Python

rev. 1d902e1fdfff69f8aafe42b2306fa317ef96d562 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/aws_lambda/__init__.pyi

@@ -1,0 +143,0 @@
    1         -
import typing
    2         -
    3         -
class ClientApplication:
    4         -
    """
    5         -
    AWS Mobile SDK client fields.
    6         -
    """
    7         -
    8         -
    app_package_name: str
    9         -
    """
   10         -
    The package name for the mobile application invoking the function
   11         -
    """
   12         -
   13         -
    app_title: str
   14         -
    """
   15         -
    The app title for the mobile app as registered with AWS' mobile services.
   16         -
    """
   17         -
   18         -
    app_version_code: str
   19         -
    """
   20         -
    The app version code.
   21         -
    """
   22         -
   23         -
    app_version_name: str
   24         -
    """
   25         -
    The version name of the application as registered with AWS' mobile services.
   26         -
    """
   27         -
   28         -
    installation_id: str
   29         -
    """
   30         -
    The mobile app installation id
   31         -
    """
   32         -
   33         -
class ClientContext:
   34         -
    """
   35         -
    Client context sent by the AWS Mobile SDK.
   36         -
    """
   37         -
   38         -
    client: ClientApplication
   39         -
    """
   40         -
    Information about the mobile application invoking the function.
   41         -
    """
   42         -
   43         -
    custom: typing.Dict[str, str]
   44         -
    """
   45         -
    Custom properties attached to the mobile event context.
   46         -
    """
   47         -
   48         -
    environment: typing.Dict[str, str]
   49         -
    """
   50         -
    Environment settings from the mobile client.
   51         -
    """
   52         -
   53         -
class CognitoIdentity:
   54         -
    """
   55         -
    Cognito identity information sent with the event
   56         -
    """
   57         -
   58         -
    identity_id: str
   59         -
    """
   60         -
    The unique identity id for the Cognito credentials invoking the function.
   61         -
    """
   62         -
   63         -
    identity_pool_id: str
   64         -
    """
   65         -
    The identity pool id the caller is "registered" with.
   66         -
    """
   67         -
   68         -
class Config:
   69         -
    """
   70         -
    Configuration derived from environment variables.
   71         -
    """
   72         -
   73         -
    function_name: str
   74         -
    """
   75         -
    The name of the function.
   76         -
    """
   77         -
   78         -
    log_group: str
   79         -
    """
   80         -
    The name of the Amazon CloudWatch Logs group for the function.
   81         -
    """
   82         -
   83         -
    log_stream: str
   84         -
    """
   85         -
    The name of the Amazon CloudWatch Logs stream for the function.
   86         -
    """
   87         -
   88         -
    memory: int
   89         -
    """
   90         -
    The amount of memory available to the function in MB.
   91         -
    """
   92         -
   93         -
    version: str
   94         -
    """
   95         -
    The version of the function being executed.
   96         -
    """
   97         -
   98         -
class LambdaContext:
   99         -
    """
  100         -
    The Lambda function execution context. The values in this struct
  101         -
    are populated using the [Lambda environment variables](https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html)
  102         -
    and the headers returned by the poll request to the Runtime APIs.
  103         -
    """
  104         -
  105         -
    client_context: typing.Optional[ClientContext]
  106         -
    """
  107         -
    The client context object sent by the AWS mobile SDK. This field is
  108         -
    empty unless the function is invoked using an AWS mobile SDK.
  109         -
    """
  110         -
  111         -
    deadline: int
  112         -
    """
  113         -
    The execution deadline for the current invocation in milliseconds.
  114         -
    """
  115         -
  116         -
    env_config: Config
  117         -
    """
  118         -
    Lambda function configuration from the local environment variables.
  119         -
    Includes information such as the function name, memory allocation,
  120         -
    version, and log streams.
  121         -
    """
  122         -
  123         -
    identity: typing.Optional[CognitoIdentity]
  124         -
    """
  125         -
    The Cognito identity that invoked the function. This field is empty
  126         -
    unless the invocation request to the Lambda APIs was made using AWS
  127         -
    credentials issues by Amazon Cognito Identity Pools.
  128         -
    """
  129         -
  130         -
    invoked_function_arn: str
  131         -
    """
  132         -
    The ARN of the Lambda function being invoked.
  133         -
    """
  134         -
  135         -
    request_id: str
  136         -
    """
  137         -
    The AWS request ID generated by the Lambda service.
  138         -
    """
  139         -
  140         -
    xray_trace_id: typing.Optional[str]
  141         -
    """
  142         -
    The X-Ray trace ID for the current invocation.
  143         -
    """

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/error/__init__.pyi

@@ -1,0 +125,0 @@
    1         -
import ebs.model
    2         -
import typing
    3         -
    4         -
class AccessDeniedException(Exception):
    5         -
    """
    6         -
    <p>You do not have sufficient access to perform this action.</p>
    7         -
    """
    8         -
    9         -
    message: typing.Optional[str]
   10         -
   11         -
    reason: ebs.model.AccessDeniedExceptionReason
   12         -
    """
   13         -
    <p>The reason for the exception.</p>
   14         -
    """
   15         -
   16         -
    def __init__(self, message: typing.Optional[str] = ..., reason: ebs.model.AccessDeniedExceptionReason) -> None:
   17         -
        ...
   18         -
   19         -
   20         -
class ConcurrentLimitExceededException(Exception):
   21         -
    """
   22         -
    <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
   23         -
    """
   24         -
   25         -
    message: typing.Optional[str]
   26         -
   27         -
    def __init__(self, message: typing.Optional[str] = ...) -> None:
   28         -
        ...
   29         -
   30         -
   31         -
class ConflictException(Exception):
   32         -
    """
   33         -
    <p>The request uses the same client token as a previous, but non-identical request.</p>
   34         -
    """
   35         -
   36         -
    message: typing.Optional[str]
   37         -
   38         -
    def __init__(self, message: typing.Optional[str] = ...) -> None:
   39         -
        ...
   40         -
   41         -
   42         -
class InternalServerError(Exception):
   43         -
    message: str
   44         -
   45         -
    def __init__(self, message: str) -> None:
   46         -
        ...
   47         -
   48         -
   49         -
class InternalServerException(Exception):
   50         -
    """
   51         -
    <p>An internal error has occurred.</p>
   52         -
    """
   53         -
   54         -
    message: typing.Optional[str]
   55         -
   56         -
    def __init__(self, message: typing.Optional[str] = ...) -> None:
   57         -
        ...
   58         -
   59         -
   60         -
class RequestThrottledException(Exception):
   61         -
    """
   62         -
    <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
   63         -
    """
   64         -
   65         -
    message: typing.Optional[str]
   66         -
   67         -
    reason: typing.Optional[ebs.model.RequestThrottledExceptionReason]
   68         -
    """
   69         -
    <p>The reason for the exception.</p>
   70         -
    """
   71         -
   72         -
    def __init__(self, message: typing.Optional[str] = ..., reason: typing.Optional[ebs.model.RequestThrottledExceptionReason] = ...) -> None:
   73         -
        ...
   74         -
   75         -
   76         -
class ResourceNotFoundException(Exception):
   77         -
    """
   78         -
    <p>The specified resource does not exist.</p>
   79         -
    """
   80         -
   81         -
    message: typing.Optional[str]
   82         -
   83         -
    reason: typing.Optional[ebs.model.ResourceNotFoundExceptionReason]
   84         -
    """
   85         -
    <p>The reason for the exception.</p>
   86         -
    """
   87         -
   88         -
    def __init__(self, message: typing.Optional[str] = ..., reason: typing.Optional[ebs.model.ResourceNotFoundExceptionReason] = ...) -> None:
   89         -
        ...
   90         -
   91         -
   92         -
class ServiceQuotaExceededException(Exception):
   93         -
    """
   94         -
    <p>Your current service quotas do not allow you to perform this action.</p>
   95         -
    """
   96         -
   97         -
    message: typing.Optional[str]
   98         -
   99         -
    reason: typing.Optional[ebs.model.ServiceQuotaExceededExceptionReason]
  100         -
    """
  101         -
    <p>The reason for the exception.</p>
  102         -
    """
  103         -
  104         -
    def __init__(self, reason: typing.Optional[ebs.model.ServiceQuotaExceededExceptionReason] = ..., message: typing.Optional[str] = ...) -> None:
  105         -
        ...
  106         -
  107         -
  108         -
class ValidationException(Exception):
  109         -
    """
  110         -
    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
  111         -
    """
  112         -
  113         -
    field_list: typing.Optional[typing.List[ebs.model.ValidationExceptionField]]
  114         -
    """
  115         -
    A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
  116         -
    """
  117         -
  118         -
    message: str
  119         -
    """
  120         -
    A summary of the validation failure.
  121         -
    """
  122         -
  123         -
    def __init__(self, message: str, field_list: typing.Optional[typing.List[ebs.model.ValidationExceptionField]] = ...) -> None:
  124         -
        ...
  125         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/input/__init__.pyi

@@ -1,0 +219,0 @@
    1         -
import ebs.model
    2         -
import ebs.types
    3         -
import typing
    4         -
    5         -
class CompleteSnapshotInput:
    6         -
    changed_blocks_count: int
    7         -
    """
    8         -
    <p>The number of blocks that were written to the snapshot.</p>
    9         -
    """
   10         -
   11         -
    checksum: typing.Optional[str]
   12         -
    """
   13         -
    <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
   14         -
    <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
   15         -
    """
   16         -
   17         -
    checksum_aggregation_method: typing.Optional[ebs.model.ChecksumAggregationMethod]
   18         -
    """
   19         -
    <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
   20         -
    """
   21         -
   22         -
    checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm]
   23         -
    """
   24         -
    <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
   25         -
    """
   26         -
   27         -
    snapshot_id: str
   28         -
    """
   29         -
    <p>The ID of the snapshot.</p>
   30         -
    """
   31         -
   32         -
    def __init__(self, changed_blocks_count: int, checksum_aggregation_method: typing.Optional[ebs.model.ChecksumAggregationMethod] = ..., checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm] = ..., snapshot_id: str, checksum: typing.Optional[str] = ...) -> None:
   33         -
        ...
   34         -
   35         -
   36         -
class GetSnapshotBlockInput:
   37         -
    block_index: int
   38         -
    """
   39         -
    <p>The block index of the block from which to get data.</p>
   40         -
    <p>Obtain the <code>BlockIndex</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
   41         -
    """
   42         -
   43         -
    block_token: str
   44         -
    """
   45         -
    <p>The block token of the block from which to get data.</p>
   46         -
    <p>Obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
   47         -
    """
   48         -
   49         -
    snapshot_id: str
   50         -
    """
   51         -
    <p>The ID of the snapshot containing the block from which to get data.</p>
   52         -
    """
   53         -
   54         -
    def __init__(self, snapshot_id: str, block_token: str, block_index: int) -> None:
   55         -
        ...
   56         -
   57         -
   58         -
class ListChangedBlocksInput:
   59         -
    first_snapshot_id: typing.Optional[str]
   60         -
    """
   61         -
    <p>The ID of the first snapshot to use for the comparison.</p><important>
   62         -
    <p>The <code>FirstSnapshotID</code> parameter must be specified with a <code>SecondSnapshotId</code> parameter; otherwise, an error occurs.</p>
   63         -
    </important>
   64         -
    """
   65         -
   66         -
    max_results: typing.Optional[int]
   67         -
    """
   68         -
    <p>The number of results to return.</p>
   69         -
    """
   70         -
   71         -
    next_token: typing.Optional[str]
   72         -
    """
   73         -
    <p>The token to request the next page of results.</p>
   74         -
    """
   75         -
   76         -
    second_snapshot_id: str
   77         -
    """
   78         -
    <p>The ID of the second snapshot to use for the comparison.</p><important>
   79         -
    <p>The <code>SecondSnapshotId</code> parameter must be specified with a <code>FirstSnapshotID</code> parameter; otherwise, an error occurs.</p>
   80         -
    </important>
   81         -
    """
   82         -
   83         -
    starting_block_index: typing.Optional[int]
   84         -
    """
   85         -
    <p>The block index from which the comparison should start.</p>
   86         -
    <p>The list in the response will start from this block index or the next valid block index in the snapshots.</p>
   87         -
    """
   88         -
   89         -
    def __init__(self, second_snapshot_id: str, first_snapshot_id: typing.Optional[str] = ..., next_token: typing.Optional[str] = ..., max_results: typing.Optional[int] = ..., starting_block_index: typing.Optional[int] = ...) -> None:
   90         -
        ...
   91         -
   92         -
   93         -
class ListSnapshotBlocksInput:
   94         -
    max_results: typing.Optional[int]
   95         -
    """
   96         -
    <p>The number of results to return.</p>
   97         -
    """
   98         -
   99         -
    next_token: typing.Optional[str]
  100         -
    """
  101         -
    <p>The token to request the next page of results.</p>
  102         -
    """
  103         -
  104         -
    snapshot_id: str
  105         -
    """
  106         -
    <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
  107         -
    """
  108         -
  109         -
    starting_block_index: typing.Optional[int]
  110         -
    """
  111         -
    <p>The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.</p>
  112         -
    """
  113         -
  114         -
    def __init__(self, max_results: typing.Optional[int] = ..., starting_block_index: typing.Optional[int] = ..., next_token: typing.Optional[str] = ..., snapshot_id: str) -> None:
  115         -
        ...
  116         -
  117         -
  118         -
class PutSnapshotBlockInput:
  119         -
    block_data: ebs.types.ByteStream
  120         -
    """
  121         -
    <p>The data to write to the block.</p>
  122         -
    <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
  123         -
    """
  124         -
  125         -
    block_index: int
  126         -
    """
  127         -
    <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
  128         -
    """
  129         -
  130         -
    checksum: str
  131         -
    """
  132         -
    <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
  133         -
    """
  134         -
  135         -
    checksum_algorithm: ebs.model.ChecksumAlgorithm
  136         -
    """
  137         -
    <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
  138         -
    """
  139         -
  140         -
    data_length: int
  141         -
    """
  142         -
    <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code>.</p>
  143         -
    <p>Valid values: <code>524288</code></p>
  144         -
    """
  145         -
  146         -
    progress: typing.Optional[int]
  147         -
    """
  148         -
    <p>The progress of the write process, as a percentage.</p>
  149         -
    """
  150         -
  151         -
    snapshot_id: str
  152         -
    """
  153         -
    <p>The ID of the snapshot.</p>
  154         -
    """
  155         -
  156         -
    def __init__(self, snapshot_id: str, block_index: int, checksum: str, progress: typing.Optional[int] = ..., block_data: ebs.types.ByteStream, data_length: int, checksum_algorithm: ebs.model.ChecksumAlgorithm) -> None:
  157         -
        ...
  158         -
  159         -
  160         -
class StartSnapshotInput:
  161         -
    client_token: typing.Optional[str]
  162         -
    """
  163         -
    <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
  164         -
    <p>If you do not specify a client token, one is automatically generated by the AWS SDK.</p>
  165         -
    <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
  166         -
    """
  167         -
  168         -
    description: typing.Optional[str]
  169         -
    """
  170         -
    <p>A description for the snapshot.</p>
  171         -
    """
  172         -
  173         -
    encrypted: typing.Optional[bool]
  174         -
    """
  175         -
    <p>Indicates whether to encrypt the snapshot. To create an encrypted snapshot, specify <code>true</code>. To create an unencrypted snapshot, omit this parameter.</p>
  176         -
    <p>If you specify a value for <b>ParentSnapshotId</b>, omit this parameter.</p>
  177         -
    <p>If you specify <code>true</code>, the snapshot is encrypted using the CMK specified using the <b>KmsKeyArn</b> parameter. If no value is specified for <b>KmsKeyArn</b>, the default CMK for your account is used. If no default CMK has been specified for your account, the AWS managed CMK is used. To set a default CMK for your account, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html"> ModifyEbsDefaultKmsKeyId</a>.</p>
  178         -
    <p>If your account is enabled for encryption by default, you cannot set this parameter to <code>false</code>. In this case, you can omit this parameter.</p>
  179         -
    <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
  180         -
    """
  181         -
  182         -
    kms_key_arn: typing.Optional[str]
  183         -
    """
  184         -
    <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) to be used to encrypt the snapshot. If you do not specify a CMK, the default AWS managed CMK is used.</p>
  185         -
    <p>If you specify a <b>ParentSnapshotId</b>, omit this parameter; the snapshot will be encrypted using the same CMK that was used to encrypt the parent snapshot.</p>
  186         -
    <p>If <b>Encrypted</b> is set to <code>true</code>, you must specify a CMK ARN.</p>
  187         -
    """
  188         -
  189         -
    parent_snapshot_id: typing.Optional[str]
  190         -
    """
  191         -
    <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p>
  192         -
    <p>If your account is enabled for encryption by default, you cannot use an unencrypted snapshot as a parent snapshot. You must first create an encrypted copy of the parent snapshot using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html">CopySnapshot</a>.</p>
  193         -
    """
  194         -
  195         -
    tags: typing.Optional[typing.List[ebs.model.Tag]]
  196         -
    """
  197         -
    <p>The tags to apply to the snapshot.</p>
  198         -
    """
  199         -
  200         -
    timeout: typing.Optional[int]
  201         -
    """
  202         -
    <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p>
  203         -
    <ul>
  204         -
    <li>
  205         -
    <p>No blocks are written to the snapshot.</p></li>
  206         -
    <li>
  207         -
    <p>The snapshot is not completed after writing the last block of data.</p></li>
  208         -
    </ul>
  209         -
    <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>
  210         -
    """
  211         -
  212         -
    volume_size: int
  213         -
    """
  214         -
    <p>The size of the volume, in GiB. The maximum size is <code>16384</code> GiB (16 TiB).</p>
  215         -
    """
  216         -
  217         -
    def __init__(self, timeout: typing.Optional[int] = ..., client_token: typing.Optional[str] = ..., volume_size: int, tags: typing.Optional[typing.List[ebs.model.Tag]] = ..., encrypted: typing.Optional[bool] = ..., kms_key_arn: typing.Optional[str] = ..., parent_snapshot_id: typing.Optional[str] = ..., description: typing.Optional[str] = ...) -> None:
  218         -
        ...
  219         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/logging/__init__.pyi

@@ -1,0 +26,0 @@
    1         -
import pathlib
    2         -
import typing
    3         -
    4         -
class TracingHandler:
    5         -
    """
    6         -
    Modifies the Python `logging` module to deliver its log messages using [tracing::Subscriber] events.
    7         -
    8         -
    To achieve this goal, the following changes are made to the module:
    9         -
    - A new builtin function `logging.py_tracing_event` transcodes `logging.LogRecord`s to `tracing::Event`s. This function
   10         -
      is not exported in `logging.__all__`, as it is not intended to be called directly.
   11         -
    - A new class `logging.TracingHandler` provides a `logging.Handler` that delivers all records to `python_tracing`.
   12         -
    """
   13         -
   14         -
    def handler(self) -> typing.Any:
   15         -
        ...
   16         -
   17         -
   18         -
    def __init__(self, level: typing.Optional[int] = ..., logfile: typing.Optional[pathlib.Path] = ..., format: typing.Optional[typing.Literal['compact', 'pretty', 'json']] = ...) -> None:
   19         -
        ...
   20         -
   21         -
   22         -
def py_tracing_event() -> None:
   23         -
    """
   24         -
    Consumes a Python `logging.LogRecord` and emits a Rust [tracing::Event] instead.
   25         -
    """
   26         -
    ...

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/middleware/__init__.pyi

@@ -1,0 +78,0 @@
    1         -
import typing
    2         -
    3         -
class MiddlewareException(Exception):
    4         -
    """
    5         -
    Exception that can be thrown from a Python middleware.
    6         -
    7         -
    It allows to specify a message and HTTP status code and implementing protocol specific capabilities
    8         -
    to build a [aws_smithy_http_server::response::Response] from it.
    9         -
    """
   10         -
   11         -
    message: str
   12         -
   13         -
    status_code: int
   14         -
   15         -
    def __init__(self, message: str, status_code: typing.Optional[int] = ...) -> None:
   16         -
        ...
   17         -
   18         -
   19         -
class Request:
   20         -
    """
   21         -
    Python-compatible [Request] object.
   22         -
    """
   23         -
   24         -
    body: typing.Awaitable[bytes]
   25         -
    """
   26         -
    Return the HTTP body of this request.
   27         -
    Note that this is a costly operation because the whole request body is cloned.
   28         -
    """
   29         -
   30         -
    headers: typing.MutableMapping[str, str]
   31         -
    """
   32         -
    Return the HTTP headers of this request.
   33         -
    """
   34         -
   35         -
    method: str
   36         -
    """
   37         -
    Return the HTTP method of this request.
   38         -
    """
   39         -
   40         -
    uri: str
   41         -
    """
   42         -
    Return the URI of this request.
   43         -
    """
   44         -
   45         -
    version: str
   46         -
    """
   47         -
    Return the HTTP version of this request.
   48         -
    """
   49         -
   50         -
class Response:
   51         -
    """
   52         -
    Python-compatible [Response] object.
   53         -
    """
   54         -
   55         -
    body: typing.Awaitable[bytes]
   56         -
    """
   57         -
    Return the HTTP body of this response.
   58         -
    Note that this is a costly operation because the whole response body is cloned.
   59         -
    """
   60         -
   61         -
    headers: typing.MutableMapping[str, str]
   62         -
    """
   63         -
    Return the HTTP headers of this response.
   64         -
    """
   65         -
   66         -
    status: int
   67         -
    """
   68         -
    Return the HTTP status of this response.
   69         -
    """
   70         -
   71         -
    version: str
   72         -
    """
   73         -
    Return the HTTP version of this response.
   74         -
    """
   75         -
   76         -
    def __init__(self, status: int, headers: typing.Optional[typing.Dict[str, str]] = ..., body: typing.Optional[bytes] = ...) -> None:
   77         -
        ...
   78         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/model/__init__.pyi

@@ -1,0 +141,0 @@
    1         -
import typing
    2         -
    3         -
class AccessDeniedExceptionReason:
    4         -
    DependencyAccessDenied: AccessDeniedExceptionReason
    5         -
    6         -
    UnauthorizedAccount: AccessDeniedExceptionReason
    7         -
    8         -
    name: typing.Any
    9         -
   10         -
    value: typing.Any
   11         -
   12         -
class Block:
   13         -
    """
   14         -
    <p>A block of data in an Amazon Elastic Block Store snapshot.</p>
   15         -
    """
   16         -
   17         -
    block_index: typing.Optional[int]
   18         -
    """
   19         -
    <p>The block index.</p>
   20         -
    """
   21         -
   22         -
    block_token: typing.Optional[str]
   23         -
    """
   24         -
    <p>The block token for the block index.</p>
   25         -
    """
   26         -
   27         -
    def __init__(self, block_token: typing.Optional[str] = ..., block_index: typing.Optional[int] = ...) -> None:
   28         -
        ...
   29         -
   30         -
   31         -
class ChangedBlock:
   32         -
    """
   33         -
    <p>A block of data in an Amazon Elastic Block Store snapshot that is different from another snapshot of the same volume/snapshot lineage.</p>
   34         -
    """
   35         -
   36         -
    block_index: typing.Optional[int]
   37         -
    """
   38         -
    <p>The block index.</p>
   39         -
    """
   40         -
   41         -
    first_block_token: typing.Optional[str]
   42         -
    """
   43         -
    <p>The block token for the block index of the <code>FirstSnapshotId</code> specified in the <code>ListChangedBlocks</code> operation. This value is absent if the first snapshot does not have the changed block that is on the second snapshot.</p>
   44         -
    """
   45         -
   46         -
    second_block_token: typing.Optional[str]
   47         -
    """
   48         -
    <p>The block token for the block index of the <code>SecondSnapshotId</code> specified in the <code>ListChangedBlocks</code> operation.</p>
   49         -
    """
   50         -
   51         -
    def __init__(self, first_block_token: typing.Optional[str] = ..., block_index: typing.Optional[int] = ..., second_block_token: typing.Optional[str] = ...) -> None:
   52         -
        ...
   53         -
   54         -
   55         -
class ChecksumAggregationMethod:
   56         -
    ChecksumAggregationLinear: ChecksumAggregationMethod
   57         -
   58         -
    name: typing.Any
   59         -
   60         -
    value: typing.Any
   61         -
   62         -
class ChecksumAlgorithm:
   63         -
    ChecksumAlgorithmSha256: ChecksumAlgorithm
   64         -
   65         -
    name: typing.Any
   66         -
   67         -
    value: typing.Any
   68         -
   69         -
class RequestThrottledExceptionReason:
   70         -
    AccountThrottled: RequestThrottledExceptionReason
   71         -
   72         -
    DependencyRequestThrottled: RequestThrottledExceptionReason
   73         -
   74         -
    name: typing.Any
   75         -
   76         -
    value: typing.Any
   77         -
   78         -
class ResourceNotFoundExceptionReason:
   79         -
    DependencyResourceNotFound: ResourceNotFoundExceptionReason
   80         -
   81         -
    SnapshotNotFound: ResourceNotFoundExceptionReason
   82         -
   83         -
    name: typing.Any
   84         -
   85         -
    value: typing.Any
   86         -
   87         -
class ServiceQuotaExceededExceptionReason:
   88         -
    DependencyServiceQuotaExceeded: ServiceQuotaExceededExceptionReason
   89         -
   90         -
    name: typing.Any
   91         -
   92         -
    value: typing.Any
   93         -
   94         -
class Status:
   95         -
    Completed: Status
   96         -
   97         -
    Error: Status
   98         -
   99         -
    Pending: Status
  100         -
  101         -
    name: typing.Any
  102         -
  103         -
    value: typing.Any
  104         -
  105         -
class Tag:
  106         -
    """
  107         -
    <p>Describes a tag.</p>
  108         -
    """
  109         -
  110         -
    key: typing.Optional[str]
  111         -
    """
  112         -
    <p>The key of the tag.</p>
  113         -
    """
  114         -
  115         -
    value: typing.Optional[str]
  116         -
    """
  117         -
    <p>The value of the tag.</p>
  118         -
    """
  119         -
  120         -
    def __init__(self, key: typing.Optional[str] = ..., value: typing.Optional[str] = ...) -> None:
  121         -
        ...
  122         -
  123         -
  124         -
class ValidationExceptionField:
  125         -
    """
  126         -
    Describes one specific validation failure for an input member.
  127         -
    """
  128         -
  129         -
    message: str
  130         -
    """
  131         -
    A detailed description of the validation failure.
  132         -
    """
  133         -
  134         -
    path: str
  135         -
    """
  136         -
    A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  137         -
    """
  138         -
  139         -
    def __init__(self, path: str, message: str) -> None:
  140         -
        ...
  141         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/output/__init__.pyi

@@ -1,0 +168,0 @@
    1         -
import ebs.model
    2         -
import ebs.types
    3         -
import typing
    4         -
    5         -
class CompleteSnapshotOutput:
    6         -
    status: typing.Optional[ebs.model.Status]
    7         -
    """
    8         -
    <p>The status of the snapshot.</p>
    9         -
    """
   10         -
   11         -
    def __init__(self, status: typing.Optional[ebs.model.Status] = ...) -> None:
   12         -
        ...
   13         -
   14         -
   15         -
class GetSnapshotBlockOutput:
   16         -
    block_data: ebs.types.ByteStream
   17         -
    """
   18         -
    <p>The data content of the block.</p>
   19         -
    """
   20         -
   21         -
    checksum: typing.Optional[str]
   22         -
    """
   23         -
    <p>The checksum generated for the block, which is Base64 encoded.</p>
   24         -
    """
   25         -
   26         -
    checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm]
   27         -
    """
   28         -
    <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
   29         -
    """
   30         -
   31         -
    data_length: typing.Optional[int]
   32         -
    """
   33         -
    <p>The size of the data in the block.</p>
   34         -
    """
   35         -
   36         -
    def __init__(self, data_length: typing.Optional[int] = ..., checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm] = ..., checksum: typing.Optional[str] = ..., block_data: ebs.types.ByteStream) -> None:
   37         -
        ...
   38         -
   39         -
   40         -
class ListChangedBlocksOutput:
   41         -
    block_size: typing.Optional[int]
   42         -
    """
   43         -
    <p>The size of the block.</p>
   44         -
    """
   45         -
   46         -
    changed_blocks: typing.Optional[typing.List[ebs.model.ChangedBlock]]
   47         -
    """
   48         -
    <p>An array of objects containing information about the changed blocks.</p>
   49         -
    """
   50         -
   51         -
    expiry_time: typing.Optional[ebs.types.DateTime]
   52         -
    """
   53         -
    <p>The time when the <code>BlockToken</code> expires.</p>
   54         -
    """
   55         -
   56         -
    next_token: typing.Optional[str]
   57         -
    """
   58         -
    <p>The token to use to retrieve the next page of results. This value is null when there are no more results to return.</p>
   59         -
    """
   60         -
   61         -
    volume_size: typing.Optional[int]
   62         -
    """
   63         -
    <p>The size of the volume in GB.</p>
   64         -
    """
   65         -
   66         -
    def __init__(self, block_size: typing.Optional[int] = ..., expiry_time: typing.Optional[ebs.types.DateTime] = ..., volume_size: typing.Optional[int] = ..., next_token: typing.Optional[str] = ..., changed_blocks: typing.Optional[typing.List[ebs.model.ChangedBlock]] = ...) -> None:
   67         -
        ...
   68         -
   69         -
   70         -
class ListSnapshotBlocksOutput:
   71         -
    block_size: typing.Optional[int]
   72         -
    """
   73         -
    <p>The size of the block.</p>
   74         -
    """
   75         -
   76         -
    blocks: typing.Optional[typing.List[ebs.model.Block]]
   77         -
    """
   78         -
    <p>An array of objects containing information about the blocks.</p>
   79         -
    """
   80         -
   81         -
    expiry_time: typing.Optional[ebs.types.DateTime]
   82         -
    """
   83         -
    <p>The time when the <code>BlockToken</code> expires.</p>
   84         -
    """
   85         -
   86         -
    next_token: typing.Optional[str]
   87         -
    """
   88         -
    <p>The token to use to retrieve the next page of results. This value is null when there are no more results to return.</p>
   89         -
    """
   90         -
   91         -
    volume_size: typing.Optional[int]
   92         -
    """
   93         -
    <p>The size of the volume in GB.</p>
   94         -
    """
   95         -
   96         -
    def __init__(self, volume_size: typing.Optional[int] = ..., next_token: typing.Optional[str] = ..., expiry_time: typing.Optional[ebs.types.DateTime] = ..., blocks: typing.Optional[typing.List[ebs.model.Block]] = ..., block_size: typing.Optional[int] = ...) -> None:
   97         -
        ...
   98         -
   99         -
  100         -
class PutSnapshotBlockOutput:
  101         -
    checksum: typing.Optional[str]
  102         -
    """
  103         -
    <p>The SHA256 checksum generated for the block data by Amazon EBS.</p>
  104         -
    """
  105         -
  106         -
    checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm]
  107         -
    """
  108         -
    <p>The algorithm used by Amazon EBS to generate the checksum.</p>
  109         -
    """
  110         -
  111         -
    def __init__(self, checksum_algorithm: typing.Optional[ebs.model.ChecksumAlgorithm] = ..., checksum: typing.Optional[str] = ...) -> None:
  112         -
        ...
  113         -
  114         -
  115         -
class StartSnapshotOutput:
  116         -
    block_size: typing.Optional[int]
  117         -
    """
  118         -
    <p>The size of the blocks in the snapshot, in bytes.</p>
  119         -
    """
  120         -
  121         -
    description: typing.Optional[str]
  122         -
    """
  123         -
    <p>The description of the snapshot.</p>
  124         -
    """
  125         -
  126         -
    kms_key_arn: typing.Optional[str]
  127         -
    """
  128         -
    <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) used to encrypt the snapshot.</p>
  129         -
    """
  130         -
  131         -
    owner_id: typing.Optional[str]
  132         -
    """
  133         -
    <p>The AWS account ID of the snapshot owner.</p>
  134         -
    """
  135         -
  136         -
    parent_snapshot_id: typing.Optional[str]
  137         -
    """
  138         -
    <p>The ID of the parent snapshot.</p>
  139         -
    """
  140         -
  141         -
    snapshot_id: typing.Optional[str]
  142         -
    """
  143         -
    <p>The ID of the snapshot.</p>
  144         -
    """
  145         -
  146         -
    start_time: typing.Optional[ebs.types.DateTime]
  147         -
    """
  148         -
    <p>The timestamp when the snapshot was created.</p>
  149         -
    """
  150         -
  151         -
    status: typing.Optional[ebs.model.Status]
  152         -
    """
  153         -
    <p>The status of the snapshot.</p>
  154         -
    """
  155         -
  156         -
    tags: typing.Optional[typing.List[ebs.model.Tag]]
  157         -
    """
  158         -
    <p>The tags applied to the snapshot. You can specify up to 50 tags per snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html"> Tagging your Amazon EC2 resources</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
  159         -
    """
  160         -
  161         -
    volume_size: typing.Optional[int]
  162         -
    """
  163         -
    <p>The size of the volume, in GiB.</p>
  164         -
    """
  165         -
  166         -
    def __init__(self, tags: typing.Optional[typing.List[ebs.model.Tag]] = ..., kms_key_arn: typing.Optional[str] = ..., owner_id: typing.Optional[str] = ..., volume_size: typing.Optional[int] = ..., parent_snapshot_id: typing.Optional[str] = ..., description: typing.Optional[str] = ..., snapshot_id: typing.Optional[str] = ..., block_size: typing.Optional[int] = ..., start_time: typing.Optional[ebs.types.DateTime] = ..., status: typing.Optional[ebs.model.Status] = ...) -> None:
  167         -
        ...
  168         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/socket/__init__.pyi

@@ -1,0 +27,0 @@
    1         -
import typing
    2         -
    3         -
class PySocket:
    4         -
    """
    5         -
    Socket implementation that can be shared between multiple Python processes.
    6         -
    7         -
    Python cannot handle true multi-threaded applications due to the [GIL],
    8         -
    often resulting in reduced performance and only one core used by the application.
    9         -
    To work around this, Python web applications usually create a socket with
   10         -
    SO_REUSEADDR and SO_REUSEPORT enabled that can be shared between multiple
   11         -
    Python processes, allowing you to maximize performance and use all available
   12         -
    computing capacity of the host.
   13         -
   14         -
    [GIL]: https://wiki.python.org/moin/GlobalInterpreterLock
   15         -
    """
   16         -
   17         -
    def try_clone(self) -> PySocket:
   18         -
        """
   19         -
        Clone the inner socket allowing it to be shared between multiple
   20         -
        Python processes.
   21         -
        """
   22         -
        ...
   23         -
   24         -
   25         -
    def __init__(self, address: str, port: int, backlog: typing.Optional[int] = ...) -> None:
   26         -
        ...
   27         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/tls/__init__.pyi

@@ -1,0 +10,0 @@
    1         -
import pathlib
    2         -
    3         -
class TlsConfig:
    4         -
    """
    5         -
    PyTlsConfig represents TLS configuration created from Python.
    6         -
    """
    7         -
    8         -
    def __init__(self, key_path: pathlib.Path, cert_path: pathlib.Path, reload_secs: int = ...) -> None:
    9         -
        ...
   10         -

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/types/__init__.pyi

@@ -1,0 +209,0 @@
    1         -
import typing
    2         -
    3         -
class Blob:
    4         -
    """
    5         -
    Python Wrapper for [aws_smithy_types::Blob].
    6         -
    """
    7         -
    8         -
    data: bytes
    9         -
    """
   10         -
    Python getter for the `Blob` byte array.
   11         -
    """
   12         -
   13         -
    def __init__(self, input: bytes) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class ByteStream:
   18         -
    """
   19         -
    Python Wrapper for [aws_smithy_types::byte_stream::ByteStream].
   20         -
   21         -
    ByteStream provides misuse-resistant primitives to make it easier to handle common patterns with streaming data.
   22         -
   23         -
    On the Rust side, The Python implementation wraps the original [ByteStream](aws_smithy_types::byte_stream::ByteStream)
   24         -
    in a clonable structure and implements the [Stream](futures::stream::Stream) trait for it to
   25         -
    allow Rust to handle the type transparently.
   26         -
   27         -
    On the Python side both sync and async iterators are exposed by implementing `__iter__()` and `__aiter__()` magic methods,
   28         -
    which allows to just loop over the stream chunks.
   29         -
   30         -
    ### Example of async streaming:
   31         -
   32         -
    ```python
   33         -
        stream = await ByteStream.from_path("/tmp/music.mp3")
   34         -
        async for chunk in stream:
   35         -
            print(chunk)
   36         -
    ```
   37         -
   38         -
    ### Example of sync streaming:
   39         -
   40         -
    ```python
   41         -
        stream = ByteStream.from_stream_blocking("/tmp/music.mp3")
   42         -
        for chunk in stream:
   43         -
            print(chunk)
   44         -
    ```
   45         -
   46         -
    The main difference between the two implementations is that the async one is scheduling the Python coroutines as Rust futures,
   47         -
    effectively maintaining the asyncronous behavior that Rust exposes, while the sync one is blocking the Tokio runtime to be able
   48         -
    to await one chunk at a time.
   49         -
   50         -
    The original Rust [ByteStream](aws_smithy_types::byte_stream::ByteStream) is wrapped inside a `Arc<Mutex>` to allow the type to be
   51         -
    [Clone] (required by PyO3) and to allow internal mutability, required to fetch the next chunk of data.
   52         -
    """
   53         -
   54         -
    @staticmethod
   55         -
    def from_path(path: str) -> typing.Awaitable[ByteStream]:
   56         -
        """
   57         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, forcing
   58         -
        Python to await this coroutine.
   59         -
        """
   60         -
        ...
   61         -
   62         -
   63         -
    @staticmethod
   64         -
    def from_path_blocking(path: str) -> ByteStream:
   65         -
        """
   66         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, without
   67         -
        requiring Python to await this method.
   68         -
   69         -
        **NOTE:** This method will block the Rust event loop when it is running.
   70         -
        """
   71         -
        ...
   72         -
   73         -
   74         -
    def __init__(self, input: bytes) -> None:
   75         -
        ...
   76         -
   77         -
   78         -
class DateTime:
   79         -
    """
   80         -
    Python Wrapper for [aws_smithy_types::date_time::DateTime].
   81         -
    """
   82         -
   83         -
    def as_nanos(self) -> int:
   84         -
        """
   85         -
        Returns the number of nanoseconds since the Unix epoch that this `DateTime` represents.
   86         -
        """
   87         -
        ...
   88         -
   89         -
   90         -
    def as_secs_f64(self) -> float:
   91         -
        """
   92         -
        Returns the `DateTime` value as an `f64` representing the seconds since the Unix epoch.
   93         -
        """
   94         -
        ...
   95         -
   96         -
   97         -
    @staticmethod
   98         -
    def from_fractional_secs(epoch_seconds: int, fraction: float) -> DateTime:
   99         -
        """
  100         -
        Creates a `DateTime` from a number of seconds and a fractional second since the Unix epoch.
  101         -
        """
  102         -
        ...
  103         -
  104         -
  105         -
    @staticmethod
  106         -
    def from_millis(epoch_millis: int) -> DateTime:
  107         -
        """
  108         -
        Creates a `DateTime` from a number of milliseconds since the Unix epoch.
  109         -
        """
  110         -
        ...
  111         -
  112         -
  113         -
    @staticmethod
  114         -
    def from_nanos(epoch_nanos: int) -> DateTime:
  115         -
        """
  116         -
        Creates a `DateTime` from a number of nanoseconds since the Unix epoch.
  117         -
        """
  118         -
        ...
  119         -
  120         -
  121         -
    @staticmethod
  122         -
    def from_secs(epoch_seconds: int) -> DateTime:
  123         -
        """
  124         -
        Creates a `DateTime` from a number of seconds since the Unix epoch.
  125         -
        """
  126         -
        ...
  127         -
  128         -
  129         -
    @staticmethod
  130         -
    def from_secs_and_nanos(seconds: int, subsecond_nanos: int) -> DateTime:
  131         -
        """
  132         -
        Creates a `DateTime` from a number of seconds and sub-second nanos since the Unix epoch.
  133         -
        """
  134         -
        ...
  135         -
  136         -
  137         -
    @staticmethod
  138         -
    def from_secs_f64(epoch_seconds: float) -> DateTime:
  139         -
        """
  140         -
        Creates a `DateTime` from an `f64` representing the number of seconds since the Unix epoch.
  141         -
        """
  142         -
        ...
  143         -
  144         -
  145         -
    @staticmethod
  146         -
    def from_str(s: str, format: Format) -> DateTime:
  147         -
        """
  148         -
        Parses a `DateTime` from a string using the given `format`.
  149         -
        """
  150         -
        ...
  151         -
  152         -
  153         -
    def has_subsec_nanos(self) -> bool:
  154         -
        """
  155         -
        Returns true if sub-second nanos is greater than zero.
  156         -
        """
  157         -
        ...
  158         -
  159         -
  160         -
    @staticmethod
  161         -
    def read(format: Format, delim: str) -> typing.Tuple[DateTime, str]:
  162         -
        """
  163         -
        Read 1 date of `format` from `s`, expecting either `delim` or EOF.
  164         -
  165         -
        TODO(PythonTyping): How do we represent `char` in Python?
  166         -
        """
  167         -
        ...
  168         -
  169         -
  170         -
    def secs(self) -> int:
  171         -
        """
  172         -
        Returns the epoch seconds component of the `DateTime`.
  173         -
        """
  174         -
        ...
  175         -
  176         -
  177         -
    def subsec_nanos(self) -> int:
  178         -
        """
  179         -
        Returns the sub-second nanos component of the `DateTime`.
  180         -
        """
  181         -
        ...
  182         -
  183         -
  184         -
    def to_millis(self) -> int:
  185         -
        """
  186         -
        Converts the `DateTime` to the number of milliseconds since the Unix epoch.
  187         -
        """
  188         -
        ...
  189         -
  190         -
  191         -
class Format:
  192         -
    """
  193         -
    Formats for representing a `DateTime` in the Smithy protocols.
  194         -
    """
  195         -
  196         -
    DateTime: Format
  197         -
    """
  198         -
    Formats for representing a `DateTime` in the Smithy protocols.
  199         -
    """
  200         -
  201         -
    EpochSeconds: Format
  202         -
    """
  203         -
    Formats for representing a `DateTime` in the Smithy protocols.
  204         -
    """
  205         -
  206         -
    HttpDate: Format
  207         -
    """
  208         -
    Formats for representing a `DateTime` in the Smithy protocols.
  209         -
    """