Partager via


AssetsClient.GetAsset(String, String, RequestContext) Méthode

Définition

Obtenir une ressource dans un sentShare.

public virtual Azure.Response GetAsset (string sentShareName, string assetName, Azure.RequestContext context = default);
abstract member GetAsset : string * string * Azure.RequestContext -> Azure.Response
override this.GetAsset : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetAsset (sentShareName As String, assetName As String, Optional context As RequestContext = Nothing) As Response

Paramètres

sentShareName
String

Nom du partage envoyé.

assetName
String

Nom de la ressource.

context
RequestContext

Contexte de requête, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Réponse retournée par le service. Les détails du schéma du corps de la réponse se trouvent dans la section Remarques ci-dessous.

Exceptions

sentShareName ou assetName est null.

sentShareName ou assetName est une chaîne vide, et on s’attendait à ce qu’elle ne soit pas vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler GetAsset avec les paramètres requis et analyser le résultat.

var credential = new DefaultAzureCredential();
var client = new AssetsClient("<https://my-service.azure.com>", credential);

Response response = client.GetAsset("<sentShareName>", "<assetName>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("kind").ToString());

Remarques

Obtenir une ressource sur un partage envoyé

Vous trouverez ci-dessous le schéma JSON pour la charge utile de réponse.

Corps de réponse :

Cette méthode prend l’un des objets JSON ci-dessous comme charge utile. Sélectionnez un objet JSON pour afficher le schéma correspondant.

AdlsGen2AccountAsset Schéma pour AdlsGen2AccountAsset:
{
              kind: AdlsGen2Account, # Required. The types of asset.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                location: string, # Optional. Location of the adls gen2 storage account.
                paths: [
                  {
                    containerName: string, # Required. Gets or sets the container name.
                    receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
                    senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
                  }
                ], # Required. A list of adls gen2 storage account paths to be shared.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                receiverAssetName: string, # Required. Name of the asset for the receiver.
                storageAccountResourceId: string, # Required. Resource id of the adls gen2 storage account.
              }, # Required. Adls gen 2 account asset properties
            }
~+ 1 autres objets
JSON BlobAccountAsset Schéma pour BlobAccountAsset:
{
              kind: BlobAccount, # Required. The types of asset.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                location: string, # Optional. Location of the blob storage account.
                paths: [
                  {
                    containerName: string, # Required. Gets or sets the container name.
                    receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
                    senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
                  }
                ], # Required. A list of blob storage account paths to be shared.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                receiverAssetName: string, # Required. Name of the asset for the receiver.
                storageAccountResourceId: string, # Required. Resource id of the blob storage account.
              }, # Required. Blob storage account asset properties
            }

S’applique à