Membuat atau memperbarui Shared Image Gallery.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}?api-version=2023-07-03
Parameter URI
Nama |
Dalam |
Diperlukan |
Jenis |
Deskripsi |
galleryName
|
path |
True
|
string
|
Nama Shared Image Gallery. Karakter yang diizinkan adalah alfabet dan angka dengan titik dan titik yang diizinkan di tengah. Panjang maksimum adalah 80 karakter.
|
resourceGroupName
|
path |
True
|
string
|
Nama grup sumber daya.
|
subscriptionId
|
path |
True
|
string
|
Kredensial langganan yang secara unik mengidentifikasi langganan Microsoft Azure. ID langganan membentuk bagian dari URI untuk setiap panggilan layanan.
|
api-version
|
query |
True
|
string
|
Versi Api Klien.
|
Isi Permintaan
Nama |
Diperlukan |
Jenis |
Deskripsi |
location
|
True
|
string
|
Lokasi sumber daya
|
properties.description
|
|
string
|
Deskripsi sumber daya Shared Image Gallery ini. Properti ini dapat diperbarui.
|
properties.identifier
|
|
GalleryIdentifier
|
Menjelaskan nama unik galeri.
|
properties.sharingProfile
|
|
SharingProfile
|
Profil untuk berbagi galeri ke langganan atau penyewa
|
properties.softDeletePolicy
|
|
SoftDeletePolicy
|
Berisi informasi tentang kebijakan penghapusan sementara galeri.
|
tags
|
|
object
|
Tag sumber daya
|
Respons
Nama |
Jenis |
Deskripsi |
200 OK
|
Gallery
|
OKE
|
201 Created
|
Gallery
|
Dibuat
|
202 Accepted
|
Gallery
|
Diterima
|
Other Status Codes
|
CloudError
|
Respons kesalahan yang menjelaskan mengapa operasi gagal.
|
Keamanan
azure_auth
Alur OAuth2 Azure Active Directory
Jenis:
oauth2
Alur:
implicit
URL Otorisasi:
https://login.microsoftonline.com/common/oauth2/authorize
Cakupan
Nama |
Deskripsi |
user_impersonation
|
meniru akun pengguna Anda
|
Contoh
Permintaan sampel
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03
{
"location": "West US",
"properties": {
"description": "This is the gallery description.",
"sharingProfile": {
"permissions": "Community",
"communityGalleryInfo": {
"publisherUri": "uri",
"publisherContact": "pir@microsoft.com",
"eula": "eula",
"publicNamePrefix": "PirPublic"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryInner;
import com.azure.resourcemanager.compute.models.CommunityGalleryInfo;
import com.azure.resourcemanager.compute.models.GallerySharingPermissionTypes;
import com.azure.resourcemanager.compute.models.SharingProfile;
/**
* Samples for Galleries CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* CommunityGallery_Create.json
*/
/**
* Sample code: Create a community gallery.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createACommunityGallery(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().createOrUpdate("myResourceGroup",
"myGalleryName",
new GalleryInner().withLocation("West US").withDescription("This is the gallery description.")
.withSharingProfile(new SharingProfile().withPermissions(GallerySharingPermissionTypes.COMMUNITY)
.withCommunityGalleryInfo(new CommunityGalleryInfo().withPublisherUri("uri")
.withPublisherContact("pir@microsoft.com").withEula("eula").withPublicNamePrefix("PirPublic"))),
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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Create.json
func ExampleGalleriesClient_BeginCreateOrUpdate_createACommunityGallery() {
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)
}
poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryProperties{
Description: to.Ptr("This is the gallery description."),
SharingProfile: &armcompute.SharingProfile{
CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
Eula: to.Ptr("eula"),
PublicNamePrefix: to.Ptr("PirPublic"),
PublisherContact: to.Ptr("pir@microsoft.com"),
PublisherURI: to.Ptr("uri"),
},
Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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),
// SharingProfile: &armcompute.SharingProfile{
// CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
// Eula: to.Ptr("eula"),
// PublicNamePrefix: to.Ptr("PirPublic"),
// PublisherContact: to.Ptr("pir@microsoft.com"),
// PublisherURI: to.Ptr("uri"),
// },
// Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
// },
// },
// }
}
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 Create or update a Shared Image Gallery.
*
* @summary Create or update a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Create.json
*/
async function createACommunityGallery() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const gallery = {
description: "This is the gallery description.",
location: "West US",
sharingProfile: {
communityGalleryInfo: {
eula: "eula",
publicNamePrefix: "PirPublic",
publisherContact: "pir@microsoft.com",
publisherUri: "uri",
},
permissions: "Community",
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
gallery,
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/CommunityGallery_Create.json
// this example is just showing the usage of "Galleries_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this GalleryResource
GalleryCollection collection = resourceGroupResource.GetGalleries();
// invoke the operation
string galleryName = "myGalleryName";
GalleryData data = new GalleryData(new AzureLocation("West US"))
{
Description = "This is the gallery description.",
SharingProfile = new SharingProfile()
{
Permission = GallerySharingPermissionType.Community,
CommunityGalleryInfo = new CommunityGalleryInfo()
{
PublisherUriString = "uri",
PublisherContact = "pir@microsoft.com",
Eula = "eula",
PublicNamePrefix = "PirPublic",
},
},
};
ArmOperation<GalleryResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryName, data);
GalleryResource result = lro.Value;
// 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
Respon sampel
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"sharingProfile": {
"permissions": "Community",
"communityGalleryInfo": {
"publisherUri": "uri",
"publisherContact": "pir@microsoft.com",
"eula": "eula",
"publicNamePrefix": "PirPublic"
}
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Creating",
"sharingProfile": {
"permissions": "Community",
"communityGalleryInfo": {
"publisherUri": "uri",
"publisherContact": "pir@microsoft.com",
"eula": "eula",
"publicNamePrefix": "PirPublic"
}
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"sharingProfile": {
"permissions": "Community",
"communityGalleryInfo": {
"publisherUri": "uri",
"publisherContact": "pir@microsoft.com",
"eula": "eula",
"publicNamePrefix": "PirPublic"
}
}
},
"location": "West US",
"name": "myGalleryName"
}
Create or update a simple gallery with sharing profile.
Permintaan sampel
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03
{
"location": "West US",
"properties": {
"description": "This is the gallery description.",
"sharingProfile": {
"permissions": "Groups"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryInner;
import com.azure.resourcemanager.compute.models.GallerySharingPermissionTypes;
import com.azure.resourcemanager.compute.models.SharingProfile;
/**
* Samples for Galleries CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Create_WithSharingProfile.json
*/
/**
* Sample code: Create or update a simple gallery with sharing profile.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createOrUpdateASimpleGalleryWithSharingProfile(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().createOrUpdate("myResourceGroup",
"myGalleryName",
new GalleryInner().withLocation("West US").withDescription("This is the gallery description.")
.withSharingProfile(new SharingProfile().withPermissions(GallerySharingPermissionTypes.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json
func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSharingProfile() {
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)
}
poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryProperties{
Description: to.Ptr("This is the gallery description."),
SharingProfile: &armcompute.SharingProfile{
Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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),
// SharingProfile: &armcompute.SharingProfile{
// 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 Create or update a Shared Image Gallery.
*
* @summary Create or update a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json
*/
async function createOrUpdateASimpleGalleryWithSharingProfile() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const gallery = {
description: "This is the gallery description.",
location: "West US",
sharingProfile: { permissions: "Groups" },
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
gallery,
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json
// this example is just showing the usage of "Galleries_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this GalleryResource
GalleryCollection collection = resourceGroupResource.GetGalleries();
// invoke the operation
string galleryName = "myGalleryName";
GalleryData data = new GalleryData(new AzureLocation("West US"))
{
Description = "This is the gallery description.",
SharingProfile = new SharingProfile()
{
Permission = GallerySharingPermissionType.Groups,
},
};
ArmOperation<GalleryResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryName, data);
GalleryResource result = lro.Value;
// 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
Respon sampel
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"sharingProfile": {
"permissions": "Groups"
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Creating",
"sharingProfile": {
"permissions": "Groups"
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"sharingProfile": {
"permissions": "Groups"
}
},
"location": "West US",
"name": "myGalleryName"
}
Create or update a simple gallery with soft deletion enabled.
Permintaan sampel
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03
{
"location": "West US",
"properties": {
"description": "This is the gallery description.",
"softDeletePolicy": {
"isSoftDeleteEnabled": true
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryInner;
import com.azure.resourcemanager.compute.models.SoftDeletePolicy;
/**
* Samples for Galleries CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Create_SoftDeletionEnabled.json
*/
/**
* Sample code: Create or update a simple gallery with soft deletion enabled.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createOrUpdateASimpleGalleryWithSoftDeletionEnabled(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().createOrUpdate("myResourceGroup",
"myGalleryName",
new GalleryInner().withLocation("West US").withDescription("This is the gallery description.")
.withSoftDeletePolicy(new SoftDeletePolicy().withIsSoftDeleteEnabled(true)),
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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json
func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSoftDeletionEnabled() {
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)
}
poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryProperties{
Description: to.Ptr("This is the gallery description."),
SoftDeletePolicy: &armcompute.SoftDeletePolicy{
IsSoftDeleteEnabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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),
// SoftDeletePolicy: &armcompute.SoftDeletePolicy{
// IsSoftDeleteEnabled: to.Ptr(true),
// },
// },
// }
}
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 Create or update a Shared Image Gallery.
*
* @summary Create or update a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json
*/
async function createOrUpdateASimpleGalleryWithSoftDeletionEnabled() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const gallery = {
description: "This is the gallery description.",
location: "West US",
softDeletePolicy: { isSoftDeleteEnabled: true },
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
gallery,
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json
// this example is just showing the usage of "Galleries_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this GalleryResource
GalleryCollection collection = resourceGroupResource.GetGalleries();
// invoke the operation
string galleryName = "myGalleryName";
GalleryData data = new GalleryData(new AzureLocation("West US"))
{
Description = "This is the gallery description.",
IsSoftDeleteEnabled = true,
};
ArmOperation<GalleryResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryName, data);
GalleryResource result = lro.Value;
// 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
Respon sampel
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"softDeletePolicy": {
"isSoftDeleteEnabled": true
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Creating",
"softDeletePolicy": {
"isSoftDeleteEnabled": true
}
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating",
"softDeletePolicy": {
"isSoftDeleteEnabled": true
}
},
"location": "West US",
"name": "myGalleryName"
}
Create or update a simple gallery.
Permintaan sampel
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName?api-version=2023-07-03
{
"location": "West US",
"properties": {
"description": "This is the gallery description."
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryInner;
/**
* Samples for Galleries CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/
* Gallery_Create.json
*/
/**
* Sample code: Create or update a simple gallery.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGallery(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleries().createOrUpdate("myResourceGroup",
"myGalleryName",
new GalleryInner().withLocation("West US").withDescription("This is the gallery description."),
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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create.json
func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGallery() {
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)
}
poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryProperties{
Description: to.Ptr("This is the gallery description."),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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/myGallery"),
// 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 Create or update a Shared Image Gallery.
*
* @summary Create or update a Shared Image Gallery.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create.json
*/
async function createOrUpdateASimpleGallery() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const gallery = {
description: "This is the gallery description.",
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleries.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
gallery,
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2023-07-03/examples/galleryExamples/Gallery_Create.json
// this example is just showing the usage of "Galleries_CreateOrUpdate" 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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this GalleryResource
GalleryCollection collection = resourceGroupResource.GetGalleries();
// invoke the operation
string galleryName = "myGalleryName";
GalleryData data = new GalleryData(new AzureLocation("West US"))
{
Description = "This is the gallery description.",
};
ArmOperation<GalleryResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryName, data);
GalleryResource result = lro.Value;
// 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
Respon sampel
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "myGalleryName"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
"properties": {
"description": "This is the gallery description.",
"identifier": {
"uniqueName": "{subscription-id}-MYGALLERYNAME"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myGalleryName"
}
Definisi
ApiError
Kesalahan api.
Nama |
Jenis |
Deskripsi |
code
|
string
|
Kode kesalahan.
|
details
|
ApiErrorBase[]
|
Detail kesalahan Api
|
innererror
|
InnerError
|
Kesalahan dalam Api
|
message
|
string
|
Pesan kesalahan.
|
target
|
string
|
Target kesalahan tertentu.
|
ApiErrorBase
Basis kesalahan api.
Nama |
Jenis |
Deskripsi |
code
|
string
|
Kode kesalahan.
|
message
|
string
|
Pesan kesalahan.
|
target
|
string
|
Target kesalahan tertentu.
|
CloudError
Respons kesalahan dari layanan Komputasi.
Nama |
Jenis |
Deskripsi |
error
|
ApiError
|
Kesalahan api.
|
Informasi galeri komunitas jika galeri saat ini dibagikan ke komunitas
Nama |
Jenis |
Deskripsi |
communityGalleryEnabled
|
boolean
|
Berisi info tentang apakah berbagi galeri komunitas diaktifkan.
|
eula
|
string
|
Perjanjian lisensi pengguna akhir untuk gambar galeri komunitas.
|
publicNamePrefix
|
string
|
Awalan nama galeri yang akan ditampilkan secara publik. Terlihat oleh semua pengguna.
|
publicNames
|
string[]
|
Daftar nama publik galeri komunitas.
|
publisherContact
|
string
|
Email dukungan penerbit galeri komunitas. Alamat email penerbit. Terlihat oleh semua pengguna.
|
publisherUri
|
string
|
Tautan ke situs web penerbit. Terlihat oleh semua pengguna.
|
Gallery
Menentukan informasi tentang Shared Image Gallery yang ingin Anda buat atau perbarui.
Nama |
Jenis |
Deskripsi |
id
|
string
|
Id Sumber Daya
|
location
|
string
|
Lokasi sumber daya
|
name
|
string
|
Nama sumber daya
|
properties.description
|
string
|
Deskripsi sumber daya Shared Image Gallery ini. Properti ini dapat diperbarui.
|
properties.identifier
|
GalleryIdentifier
|
Menjelaskan nama unik galeri.
|
properties.provisioningState
|
GalleryProvisioningState
|
Status galeri atau artefak galeri saat ini.
Status provisi, yang hanya muncul dalam respons.
|
properties.sharingProfile
|
SharingProfile
|
Profil untuk berbagi galeri ke langganan atau penyewa
|
properties.sharingStatus
|
SharingStatus
|
Berbagi status galeri saat ini.
|
properties.softDeletePolicy
|
SoftDeletePolicy
|
Berisi informasi tentang kebijakan penghapusan sementara galeri.
|
tags
|
object
|
Tag sumber daya
|
type
|
string
|
Jenis sumber daya
|
GalleryIdentifier
Menjelaskan nama unik galeri.
Nama |
Jenis |
Deskripsi |
uniqueName
|
string
|
Nama unik Shared Image Gallery. Nama ini dihasilkan secara otomatis oleh Azure.
|
GalleryProvisioningState
Status galeri atau artefak galeri saat ini.
Nama |
Jenis |
Deskripsi |
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Migrating
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
GallerySharingPermissionTypes
Properti ini memungkinkan Anda menentukan izin berbagi galeri. Nilai yang mungkin adalah: Privat, Grup, Komunitas.
Nama |
Jenis |
Deskripsi |
Community
|
string
|
|
Groups
|
string
|
|
Private
|
string
|
|
InnerError
Detail kesalahan dalam.
Nama |
Jenis |
Deskripsi |
errordetail
|
string
|
Pesan kesalahan internal atau cadangan pengecualian.
|
exceptiontype
|
string
|
Jenis pengecualian.
|
RegionalSharingStatus
Status berbagi regional galeri
Nama |
Jenis |
Deskripsi |
details
|
string
|
Detail kegagalan berbagi regional galeri.
|
region
|
string
|
Nama wilayah
|
state
|
SharingState
|
Status berbagi galeri.
Status berbagi galeri di wilayah saat ini
|
SharingProfile
Profil untuk berbagi galeri ke langganan atau penyewa
Nama |
Jenis |
Deskripsi |
communityGalleryInfo
|
CommunityGalleryInfo
|
Informasi galeri komunitas jika galeri saat ini dibagikan ke komunitas.
|
groups
|
SharingProfileGroup[]
|
Daftar grup profil berbagi.
|
permissions
|
GallerySharingPermissionTypes
|
Properti ini memungkinkan Anda menentukan izin berbagi galeri. Nilai yang mungkin adalah: Privat, Grup, Komunitas.
|
SharingProfileGroup
Grup profil berbagi galeri
Nama |
Jenis |
Deskripsi |
ids
|
string[]
|
Daftar id langganan/penyewa tempat galeri ditujukan untuk dibagikan.
|
type
|
SharingProfileGroupTypes
|
Properti ini memungkinkan Anda menentukan jenis grup berbagi. Nilai yang mungkin adalah: Langganan ,AADTenants.
|
SharingProfileGroupTypes
Properti ini memungkinkan Anda menentukan jenis grup berbagi. Nilai yang mungkin adalah: Langganan ,AADTenants.
Nama |
Jenis |
Deskripsi |
AADTenants
|
string
|
|
Subscriptions
|
string
|
|
SharingState
Status berbagi galeri.
Nama |
Jenis |
Deskripsi |
Failed
|
string
|
|
InProgress
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
SharingStatus
Berbagi status galeri saat ini.
Nama |
Jenis |
Deskripsi |
aggregatedState
|
SharingState
|
Status berbagi galeri.
Status berbagi agregat galeri saat ini.
|
summary
|
RegionalSharingStatus[]
|
Ringkasan semua status berbagi regional.
|
SoftDeletePolicy
Berisi informasi tentang kebijakan penghapusan sementara galeri.
Nama |
Jenis |
Deskripsi |
isSoftDeleteEnabled
|
boolean
|
Memungkinkan penghapusan sementara untuk sumber daya di galeri ini, memungkinkannya dipulihkan dalam waktu retensi.
|