检索有关共享映像库的信息。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}?api-version=2023-07-03
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}?api-version=2023-07-03&$select=Permissions&$expand=SharingProfile/Groups
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
galleryName
|
path |
True
|
string
|
共享映像库的名称。
|
resourceGroupName
|
path |
True
|
string
|
资源组的名称。
|
subscriptionId
|
path |
True
|
string
|
唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。
|
api-version
|
query |
True
|
string
|
客户端 API 版本。
|
$expand
|
query |
|
GalleryExpandParams
|
要应用于操作的展开查询选项。
|
$select
|
query |
|
SelectPermissions
|
要应用于操作的 select 表达式。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03&$select=Permissions&$expand=SharingProfile/Groups
/**
* Samples for Galleries GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* CommunityGallery_Get.json
*/
/**
* Sample code: Get a community gallery.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getACommunityGallery(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().getByResourceGroupWithResponse(
"myResourceGroup", "myGalleryName", null, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Get.json
func ExampleGalleriesClient_Get_getACommunityGallery() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
Expand: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Gallery = armcompute.Gallery{
// Name: to.Ptr("myGalleryName"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/communityGalleries/myGalleryName"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryProperties{
// Description: to.Ptr("This is the gallery description."),
// Identifier: &armcompute.GalleryIdentifier{
// UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
// },
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// SharingProfile: &armcompute.SharingProfile{
// CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
// CommunityGalleryEnabled: to.Ptr(true),
// Eula: to.Ptr("eula"),
// PublicNames: []*string{
// to.Ptr("GalleryPublicName")},
// PublisherContact: to.Ptr("pir@microsoft.com"),
// PublisherURI: to.Ptr("uri"),
// },
// Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
// },
// SharingStatus: &armcompute.SharingStatus{
// AggregatedState: to.Ptr(armcompute.SharingStateSucceeded),
// Summary: []*armcompute.RegionalSharingStatus{
// {
// Region: to.Ptr("westus"),
// State: to.Ptr(armcompute.SharingStateSucceeded),
// Details: to.Ptr(""),
// }},
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieves information about a Shared Image Gallery.
*
* @summary Retrieves information about a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Get.json
*/
async function getACommunityGallery() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.get(resourceGroupName, galleryName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Get.json
// this example is just showing the usage of "Galleries_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this GalleryResource created on azure
// for more information of creating GalleryResource, please refer to the document of GalleryResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName);
GalleryResource gallery = client.GetGalleryResource(galleryResourceId);
// invoke the operation
GalleryResource result = await gallery.GetAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
GalleryData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/communityGalleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Succeeded",
"sharingProfile": {
"permissions": "Community",
"communityGalleryInfo": {
"publisherUri": "uri",
"publisherContact": "pir@microsoft.com",
"eula": "eula",
"publicNames": [
"GalleryPublicName"
],
"communityGalleryEnabled": true
}
},
"sharingStatus": {
"aggregatedState": "Succeeded",
"summary": [
{
"region": "westus",
"state": "Succeeded",
"details": ""
}
]
}
},
"location": "West US",
"name": "myGalleryName"
}
Get a gallery with expand sharingProfile groups.
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03&$select=Permissions&$expand=SharingProfile/Groups
import com.azure.resourcemanager.compute.models.GalleryExpandParams;
/**
* Samples for Galleries GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Get_WithExpandSharingProfileGroups.json
*/
/**
* Sample code: Get a gallery with expand sharingProfile groups.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAGalleryWithExpandSharingProfileGroups(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().getByResourceGroupWithResponse(
"myResourceGroup", "myGalleryName", null, GalleryExpandParams.SHARING_PROFILE_GROUPS,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json
func ExampleGalleriesClient_Get_getAGalleryWithExpandSharingProfileGroups() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
Expand: to.Ptr(armcompute.GalleryExpandParamsSharingProfileGroups),
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Gallery = armcompute.Gallery{
// Name: to.Ptr("myGalleryName"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryProperties{
// SharingProfile: &armcompute.SharingProfile{
// Groups: []*armcompute.SharingProfileGroup{
// {
// Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
// IDs: []*string{
// to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
// to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
// },
// {
// Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
// IDs: []*string{
// to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
// }},
// Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieves information about a Shared Image Gallery.
*
* @summary Retrieves information about a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json
*/
async function getAGalleryWithExpandSharingProfileGroups() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const expand = "SharingProfile/Groups";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.get(resourceGroupName, galleryName, options);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json
// this example is just showing the usage of "Galleries_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this GalleryResource created on azure
// for more information of creating GalleryResource, please refer to the document of GalleryResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName);
GalleryResource gallery = client.GetGalleryResource(galleryResourceId);
// invoke the operation
GalleryExpand? expand = GalleryExpand.SharingProfileGroups;
GalleryResource result = await gallery.GetAsync(expand: expand);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
GalleryData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"sharingProfile": {
"permissions": "Groups",
"groups": [
{
"type": "Subscriptions",
"ids": [
"34a4ab42-0d72-47d9-bd1a-aed207386dac",
"380fd389-260b-41aa-bad9-0a83108c370b"
]
},
{
"type": "AADTenants",
"ids": [
"c24c76aa-8897-4027-9b03-8f7928b54ff6"
]
}
]
}
},
"location": "West US",
"name": "myGalleryName"
}
Get a gallery with select permissions.
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03&$select=Permissions&$expand=SharingProfile/Groups
import com.azure.resourcemanager.compute.models.SelectPermissions;
/**
* Samples for Galleries GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Get_WithSelectPermissions.json
*/
/**
* Sample code: Get a gallery with select permissions.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAGalleryWithSelectPermissions(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().getByResourceGroupWithResponse(
"myResourceGroup", "myGalleryName", SelectPermissions.PERMISSIONS, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json
func ExampleGalleriesClient_Get_getAGalleryWithSelectPermissions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: to.Ptr(armcompute.SelectPermissionsPermissions),
Expand: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Gallery = armcompute.Gallery{
// Name: to.Ptr("myGalleryName"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryProperties{
// SharingProfile: &armcompute.SharingProfile{
// Groups: []*armcompute.SharingProfileGroup{
// {
// Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
// IDs: []*string{
// to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
// to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
// },
// {
// Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
// IDs: []*string{
// to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
// }},
// Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieves information about a Shared Image Gallery.
*
* @summary Retrieves information about a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json
*/
async function getAGalleryWithSelectPermissions() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const select = "Permissions";
const options = { select };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.get(resourceGroupName, galleryName, options);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json
// this example is just showing the usage of "Galleries_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this GalleryResource created on azure
// for more information of creating GalleryResource, please refer to the document of GalleryResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName);
GalleryResource gallery = client.GetGalleryResource(galleryResourceId);
// invoke the operation
SelectPermission? select = SelectPermission.Permissions;
GalleryResource result = await gallery.GetAsync(select: select);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
GalleryData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"sharingProfile": {
"permissions": "Groups",
"groups": [
{
"type": "Subscriptions",
"ids": [
"34a4ab42-0d72-47d9-bd1a-aed207386dac",
"380fd389-260b-41aa-bad9-0a83108c370b"
]
},
{
"type": "AADTenants",
"ids": [
"c24c76aa-8897-4027-9b03-8f7928b54ff6"
]
}
]
}
},
"location": "West US",
"name": "myGalleryName"
}
Get a gallery.
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03&$select=Permissions&$expand=SharingProfile/Groups
/**
* Samples for Galleries GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Get.json
*/
/**
* Sample code: Get a gallery.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().getByResourceGroupWithResponse(
"myResourceGroup", "myGalleryName", null, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get.json
func ExampleGalleriesClient_Get_getAGallery() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
Expand: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Gallery = armcompute.Gallery{
// Name: to.Ptr("myGalleryName"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryProperties{
// Description: to.Ptr("This is the gallery description."),
// Identifier: &armcompute.GalleryIdentifier{
// UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
// },
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieves information about a Shared Image Gallery.
*
* @summary Retrieves information about a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get.json
*/
async function getAGallery() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.get(resourceGroupName, galleryName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Get.json
// this example is just showing the usage of "Galleries_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this GalleryResource created on azure
// for more information of creating GalleryResource, please refer to the document of GalleryResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName);
GalleryResource gallery = client.GetGalleryResource(galleryResourceId);
// invoke the operation
GalleryResource result = await gallery.GetAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
GalleryData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myGalleryName"
}
定义
ApiError
Api 错误。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
ApiErrorBase[]
|
Api 错误详细信息
|
innererror
|
InnerError
|
Api 内部错误
|
message
|
string
|
错误消息。
|
target
|
string
|
特定错误的目标。
|
ApiErrorBase
Api 错误基。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
message
|
string
|
错误消息。
|
target
|
string
|
特定错误的目标。
|
CloudError
来自计算服务的错误响应。
如果当前库共享到社区,则社区库的信息
名称 |
类型 |
说明 |
communityGalleryEnabled
|
boolean
|
包含有关是否启用社区库共享的信息。
|
eula
|
string
|
社区库映像的最终用户许可协议。
|
publicNamePrefix
|
string
|
将公开显示的库名称的前缀。 对所有用户可见。
|
publicNames
|
string[]
|
社区库公共名称列表。
|
publisherContact
|
string
|
社区库发布者支持电子邮件。 发布者的电子邮件地址。 对所有用户可见。
|
publisherUri
|
string
|
指向发布者网站的链接。 对所有用户可见。
|
Gallery
指定要创建或更新的共享映像库的相关信息。
名称 |
类型 |
说明 |
id
|
string
|
资源 ID
|
location
|
string
|
资源位置
|
name
|
string
|
资源名称
|
properties.description
|
string
|
此共享映像库资源的说明。 此属性可更新。
|
properties.identifier
|
GalleryIdentifier
|
描述库唯一名称。
|
properties.provisioningState
|
GalleryProvisioningState
|
库或库项目的当前状态。
预配状态,仅显示在响应中。
|
properties.sharingProfile
|
SharingProfile
|
用于将库共享到订阅或租户的配置文件
|
properties.sharingStatus
|
SharingStatus
|
当前库的共享状态。
|
properties.softDeletePolicy
|
SoftDeletePolicy
|
包含有关库的软删除策略的信息。
|
tags
|
object
|
资源标记
|
type
|
string
|
资源类型
|
GalleryExpandParams
要应用于操作的展开查询选项。
名称 |
类型 |
说明 |
SharingProfile/Groups
|
string
|
|
GalleryIdentifier
描述库唯一名称。
名称 |
类型 |
说明 |
uniqueName
|
string
|
共享映像库的唯一名称。 此名称由 Azure 自动生成。
|
GalleryProvisioningState
库或库项目的当前状态。
名称 |
类型 |
说明 |
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Migrating
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
GallerySharingPermissionTypes
此属性允许指定共享库的权限。 可能的值为: Private、Groups、Community。
名称 |
类型 |
说明 |
Community
|
string
|
|
Groups
|
string
|
|
Private
|
string
|
|
InnerError
内部错误详细信息。
名称 |
类型 |
说明 |
errordetail
|
string
|
内部错误消息或异常转储。
|
exceptiontype
|
string
|
异常类型。
|
RegionalSharingStatus
库区域共享状态
名称 |
类型 |
说明 |
details
|
string
|
库区域共享失败的详细信息。
|
region
|
string
|
区域名称
|
state
|
SharingState
|
库的共享状态。
当前区域中的库共享状态
|
SelectPermissions
要应用于操作的 select 表达式。
名称 |
类型 |
说明 |
Permissions
|
string
|
|
SharingProfile
用于将库共享到订阅或租户的配置文件
SharingProfileGroup
库共享配置文件的组
SharingProfileGroupTypes
此属性允许指定共享组的类型。 可能的值为: Subscriptions、AADTenants。
名称 |
类型 |
说明 |
AADTenants
|
string
|
|
Subscriptions
|
string
|
|
SharingState
库的共享状态。
名称 |
类型 |
说明 |
Failed
|
string
|
|
InProgress
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
SharingStatus
当前库的共享状态。
SoftDeletePolicy
包含有关库的软删除策略的信息。
名称 |
类型 |
说明 |
isSoftDeleteEnabled
|
boolean
|
为此库中的资源启用软删除,允许在保留期内恢复资源。
|