예제 #1
0
from pulumi_gcp import storage, cloudfunctions
from pulumi import export, asset

bucket = storage.Bucket("bucket")

py_bucket_object = storage.BucketObject(
    "python-zip",
    bucket=bucket.name,
    source=asset.AssetArchive({".": asset.FileArchive("./pythonfunc")}))

py_function = cloudfunctions.Function(
    "python-func",
    source_archive_bucket=bucket.name,
    runtime="python37",
    source_archive_object=py_bucket_object.name,
    entry_point="handler",
    trigger_http="true",
    available_memory_mb=128,
)

py_invoker = cloudfunctions.FunctionIamMember(
    "py-invoker",
    project=py_function.project,
    region=py_function.region,
    cloud_function=py_function.name,
    role="roles/cloudfunctions.invoker",
    member="allUsers",
)

export("python_endpoint", py_function.https_trigger_url)
예제 #2
0
    account_kind="StorageV2",
    account_tier="Standard",
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

http_container = storage.Container(
    "http",
    storage_account_name=http_storage_account.name,
    container_access_type="private")

http_zib_blob = storage.Blob("http",
                             storage_account_name=http_storage_account.name,
                             storage_container_name=http_container.name,
                             type="Block",
                             source=asset.AssetArchive(
                                 {".": asset.FileArchive("./python")}))


def get_sas(args):
    blob_sas = storage.get_account_blob_container_sas(
        connection_string=args[1],
        start="2020-01-01",
        expiry="2030-01-01",
        container_name=args[2],
        permissions=storage.GetAccountBlobContainerSASPermissionsArgs(
            read=True,
            write=False,
            delete=False,
            list=False,
            add=False,
            create=False,
예제 #3
0
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

httpdotnet_container = storage.Container(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    container_access_type="private")

httpdotnet_zib_blob = storage.ZipBlob(
    "http-dotnet",
    resource_group_name=resource_group.name,
    storage_account_name=httpdotnet_storage_account.name,
    storage_container_name=httpdotnet_container.name,
    type="block",
    content=asset.AssetArchive(
        {".": asset.FileArchive("./dotnet/bin/Debug/netcoreapp2.1/publish")}))

account_sas = storage.get_account_sas(
    connection_string=httpdotnet_storage_account.primary_connection_string,
    start="2019-01-01",
    expiry="2029-01-01",
    services={
        "blob": "true",
        "queue": "false",
        "table": "false",
        "file": "false"
    },
    resource_types={
        "service": "false",
        "container": "false",
        "object": "true"
예제 #4
0
    account_tier="Standard",
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

httpdotnet_container = storage.Container(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    container_access_type="private")

httpdotnet_zib_blob = storage.Blob(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    storage_container_name=httpdotnet_container.name,
    type="Block",
    source=asset.AssetArchive(
        {".": asset.FileArchive("./dotnet/bin/Debug/netcoreapp3.1/publish")}))


def get_sas(args):
    blob_sas = storage.get_account_blob_container_sas(
        connection_string=args[1],
        start="2020-01-01",
        expiry="2030-01-01",
        container_name=args[2],
        permissions={
            "read": "true",
            "write": "false",
            "delete": "false",
            "list": "false",
            "add": "false",
            "create": "false"