Blob
Manages a Blob within a Storage Container.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleAccount = new Azure.Storage.Account("exampleAccount", new Azure.Storage.AccountArgs
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
AccountTier = "Standard",
AccountReplicationType = "LRS",
});
var exampleContainer = new Azure.Storage.Container("exampleContainer", new Azure.Storage.ContainerArgs
{
StorageAccountName = exampleAccount.Name,
ContainerAccessType = "private",
});
var exampleBlob = new Azure.Storage.Blob("exampleBlob", new Azure.Storage.BlobArgs
{
StorageAccountName = exampleAccount.Name,
StorageContainerName = exampleContainer.Name,
Type = "Block",
Source = new FileAsset("some-local-file.zip"),
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/storage"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
AccountTier: pulumi.String("Standard"),
AccountReplicationType: pulumi.String("LRS"),
})
if err != nil {
return err
}
exampleContainer, err := storage.NewContainer(ctx, "exampleContainer", &storage.ContainerArgs{
StorageAccountName: exampleAccount.Name,
ContainerAccessType: pulumi.String("private"),
})
if err != nil {
return err
}
_, err = storage.NewBlob(ctx, "exampleBlob", &storage.BlobArgs{
StorageAccountName: exampleAccount.Name,
StorageContainerName: exampleContainer.Name,
Type: pulumi.String("Block"),
Source: pulumi.NewFileAsset("some-local-file.zip"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
account_tier="Standard",
account_replication_type="LRS")
example_container = azure.storage.Container("exampleContainer",
storage_account_name=example_account.name,
container_access_type="private")
example_blob = azure.storage.Blob("exampleBlob",
storage_account_name=example_account.name,
storage_container_name=example_container.name,
type="Block",
source=pulumi.FileAsset("some-local-file.zip"))import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleAccount = new azure.storage.Account("exampleAccount", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
accountTier: "Standard",
accountReplicationType: "LRS",
});
const exampleContainer = new azure.storage.Container("exampleContainer", {
storageAccountName: exampleAccount.name,
containerAccessType: "private",
});
const exampleBlob = new azure.storage.Blob("exampleBlob", {
storageAccountName: exampleAccount.name,
storageContainerName: exampleContainer.name,
type: "Block",
source: new pulumi.asset.FileAsset("some-local-file.zip"),
});Create a Blob Resource
new Blob(name: string, args: BlobArgs, opts?: CustomResourceOptions);def Blob(resource_name, opts=None, access_tier=None, content_type=None, metadata=None, name=None, parallelism=None, size=None, source=None, source_content=None, source_uri=None, storage_account_name=None, storage_container_name=None, type=None, __props__=None);public Blob(string name, BlobArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args BlobArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BlobArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BlobArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Blob Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Blob resource accepts the following input properties:
- Storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- Storage
Container stringName The name of the storage container in which this blob should be created.
- Type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- Access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- Content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- Metadata Dictionary<string, string>
A map of custom blob metadata.
- Name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- Parallelism int
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- Size int
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- Source
Asset
Or Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- Source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- Source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.
- Storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- Storage
Container stringName The name of the storage container in which this blob should be created.
- Type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- Access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- Content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- Metadata map[string]string
A map of custom blob metadata.
- Name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- Parallelism int
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- Size int
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- Source
pulumi.
Asset Or Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- Source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- Source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.
- storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- storage
Container stringName The name of the storage container in which this blob should be created.
- type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- metadata {[key: string]: string}
A map of custom blob metadata.
- name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- parallelism number
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- size number
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- source
pulumi.asset.
Asset | pulumi.asset. Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.
- storage_
account_ strname Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- storage_
container_ strname The name of the storage container in which this blob should be created.
- type str
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- access_
tier str The access tier of the storage blob. Possible values are
Archive,CoolandHot.- content_
type str The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- metadata Dict[str, str]
A map of custom blob metadata.
- name str
The name of the storage blob. Must be unique within the storage container the blob is located.
- parallelism float
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- size float
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- source
Union[pulumi.
Asset, pulumi. Archive] An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- source_
content str The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- source_
uri str The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.
Outputs
All input properties are implicitly available as output properties. Additionally, the Blob resource produces the following output properties:
Look up an Existing Blob Resource
Get an existing Blob resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BlobState, opts?: CustomResourceOptions): Blobstatic get(resource_name, id, opts=None, access_tier=None, content_type=None, metadata=None, name=None, parallelism=None, size=None, source=None, source_content=None, source_uri=None, storage_account_name=None, storage_container_name=None, type=None, url=None, __props__=None);public static Blob Get(string name, Input<string> id, BlobState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- Content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- Metadata Dictionary<string, string>
A map of custom blob metadata.
- Name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- Parallelism int
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- Size int
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- Source
Asset
Or Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- Source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- Source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.- Storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- Storage
Container stringName The name of the storage container in which this blob should be created.
- Type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- Url string
The URL of the blob
- Access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- Content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- Metadata map[string]string
A map of custom blob metadata.
- Name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- Parallelism int
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- Size int
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- Source
pulumi.
Asset Or Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- Source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- Source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.- Storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- Storage
Container stringName The name of the storage container in which this blob should be created.
- Type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- Url string
The URL of the blob
- access
Tier string The access tier of the storage blob. Possible values are
Archive,CoolandHot.- content
Type string The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- metadata {[key: string]: string}
A map of custom blob metadata.
- name string
The name of the storage blob. Must be unique within the storage container the blob is located.
- parallelism number
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- size number
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- source
pulumi.asset.
Asset | pulumi.asset. Archive An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- source
Content string The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- source
Uri string The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.- storage
Account stringName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- storage
Container stringName The name of the storage container in which this blob should be created.
- type string
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- url string
The URL of the blob
- access_
tier str The access tier of the storage blob. Possible values are
Archive,CoolandHot.- content_
type str The content type of the storage blob. Cannot be defined if
source_uriis defined. Defaults toapplication/octet-stream.- metadata Dict[str, str]
A map of custom blob metadata.
- name str
The name of the storage blob. Must be unique within the storage container the blob is located.
- parallelism float
The number of workers per CPU core to run for concurrent uploads. Defaults to
8.- size float
Used only for
pageblobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.- source
Union[pulumi.
Asset, pulumi. Archive] An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if
source_contentorsource_uriis specified.- source_
content str The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if
sourceorsource_uriis specified.- source_
uri str The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if
sourceorsource_contentis specified.- storage_
account_ strname Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
- storage_
container_ strname The name of the storage container in which this blob should be created.
- type str
The type of the storage blob to be created. Possible values are
Append,BlockorPage. Changing this forces a new resource to be created.- url str
The URL of the blob
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.