// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.compute.generated;

import com.azure.resourcemanager.compute.fluent.models.SharingUpdateInner;
import com.azure.resourcemanager.compute.models.SharingProfileGroup;
import com.azure.resourcemanager.compute.models.SharingProfileGroupTypes;
import com.azure.resourcemanager.compute.models.SharingUpdateOperationTypes;
import java.util.Arrays;

/** Samples for GallerySharingProfile Update. */
public final class GallerySharingProfileUpdateSamples {
    /*
     * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json
     */
    /**
     * Sample code: share a gallery to community.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void shareAGalleryToCommunity(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .virtualMachines()
            .manager()
            .serviceClient()
            .getGallerySharingProfiles()
            .update(
                "myResourceGroup",
                "myGalleryName",
                new SharingUpdateInner().withOperationType(SharingUpdateOperationTypes.ENABLE_COMMUNITY),
                com.azure.core.util.Context.NONE);
    }

    /*
     * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json
     */
    /**
     * Sample code: reset sharing profile of a gallery.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void resetSharingProfileOfAGallery(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .virtualMachines()
            .manager()
            .serviceClient()
            .getGallerySharingProfiles()
            .update(
                "myResourceGroup",
                "myGalleryName",
                new SharingUpdateInner().withOperationType(SharingUpdateOperationTypes.RESET),
                com.azure.core.util.Context.NONE);
    }

    /*
     * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json
     */
    /**
     * Sample code: Add sharing id to the sharing profile of a gallery.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void addSharingIdToTheSharingProfileOfAGallery(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .virtualMachines()
            .manager()
            .serviceClient()
            .getGallerySharingProfiles()
            .update(
                "myResourceGroup",
                "myGalleryName",
                new SharingUpdateInner()
                    .withOperationType(SharingUpdateOperationTypes.ADD)
                    .withGroups(
                        Arrays
                            .asList(
                                new SharingProfileGroup()
                                    .withType(SharingProfileGroupTypes.SUBSCRIPTIONS)
                                    .withIds(
                                        Arrays
                                            .asList(
                                                "34a4ab42-0d72-47d9-bd1a-aed207386dac",
                                                "380fd389-260b-41aa-bad9-0a83108c370b")),
                                new SharingProfileGroup()
                                    .withType(SharingProfileGroupTypes.AADTENANTS)
                                    .withIds(Arrays.asList("c24c76aa-8897-4027-9b03-8f7928b54ff6")))),
                com.azure.core.util.Context.NONE);
    }
}
