Skip to content

Examples#

Index > Glacier > Examples

Auto-generated documentation for Glacier type annotations stubs module types-boto3-glacier.

Client#

Implicit type annotations#

Can be used with types-boto3[glacier] package installed.

Write your Glacier code as usual, type checking and code completion should work out of the box.

# GlacierClient usage example

from boto3.session import Session


session = Session()

client = session.client("glacier")  # (1)
result = client.abort_multipart_upload()  # (2)
  1. client: GlacierClient
  2. result: EmptyResponseMetadataTypeDef
# ListJobsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("glacier")  # (1)

paginator = client.get_paginator("list_jobs")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: GlacierClient
  2. paginator: ListJobsPaginator
  3. item: ListJobsOutputTypeDef
# VaultExistsWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("glacier")  # (1)

waiter = client.get_waiter("vault_exists")  # (2)
waiter.wait()
  1. client: GlacierClient
  2. waiter: VaultExistsWaiter

Explicit type annotations#

With types-boto3-lite[glacier] or a standalone types_boto3_glacier package, you have to explicitly specify client: GlacierClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# GlacierClient usage example with type annotations

from boto3.session import Session

from types_boto3_glacier.client import GlacierClient
from types_boto3_glacier.type_defs import EmptyResponseMetadataTypeDef
from types_boto3_glacier.type_defs import AbortMultipartUploadInputRequestTypeDef


session = Session()

client: GlacierClient = session.client("glacier")

kwargs: AbortMultipartUploadInputRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.abort_multipart_upload(**kwargs)
# ListJobsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_glacier.client import GlacierClient
from types_boto3_glacier.paginator import ListJobsPaginator
from types_boto3_glacier.type_defs import ListJobsOutputTypeDef


session = Session()
client: GlacierClient = session.client("glacier")

paginator: ListJobsPaginator = client.get_paginator("list_jobs")
for item in paginator.paginate(...):
    item: ListJobsOutputTypeDef
    print(item)
# VaultExistsWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_glacier.client import GlacierClient
from types_boto3_glacier.waiter import VaultExistsWaiter

session = Session()
client: GlacierClient = session.client("glacier")

waiter: VaultExistsWaiter = client.get_waiter("vault_exists")
waiter.wait()

Service Resource#

Implicit type annotations#

Can be used with types-boto3[glacier] package installed.

# GlacierServiceResource usage example

from boto3.session import Session


session = Session()

resource = session.resource("glacier")  # (1)
result = resource.get_available_subresources()  # (2)
  1. resource: GlacierServiceResource
  2. result:
# ServiceResourceVaultsCollection usage example

from boto3.session import Session


session = Session()
resource = session.resource("glacier")  # (1)

collection = resource.vaults  # (2)
for item in collection:
    print(item)  # (3)
  1. resource: GlacierServiceResource
  2. collection: GlacierServiceResource
  3. item: Vault

Explicit type annotations#

With types-boto3-lite[glacier] or a standalone types_boto3_glacier package, you have to explicitly specify resource: GlacierServiceResource type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# GlacierServiceResource usage example with type annotations

from boto3.session import Session

from types_boto3_glacier.service_resource import GlacierServiceResource
from types_boto3_glacier.service_resource import get_available_subresources


session = Session()

resource: GlacierServiceResource = session.resource("glacier")
result: get_available_subresources = resource.get_available_subresources()
# ServiceResourceVaultsCollection usage example with type annotations

from boto3.session import Session

from types_boto3_glacier.service_resource import GlacierServiceResource
from types_boto3_glacier.service_resource import ServiceResourceVaultsCollection
from types_boto3_glacier.service_resource import Vault


session = Session()

resource: GlacierServiceResource = session.resource("glacier")

collection: ServiceResourceVaultsCollection = resource.vaults
for item in collection:
    item: Vault
    print(item)