POST https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01/stop?api-version=2023-04-01
{
"softStopTimeoutSeconds": 0
}
import com.azure.resourcemanager.workloads.models.StopRequest;
/**
* Samples for SapApplicationServerInstances StopInstance.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPApplicationServerInstances_StopInstance.json
*/
/**
* Sample code: Stop the SAP Application Server Instance.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void
stopTheSAPApplicationServerInstance(com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapApplicationServerInstances().stopInstance("test-rg", "X00", "app01",
new StopRequest().withSoftStopTimeoutSeconds(0L), 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_application_server_instances_stop_instance.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_application_server_instances.begin_stop_instance(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
application_instance_name="app01",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_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/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json
func ExampleSAPApplicationServerInstancesClient_BeginStopInstance() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloads.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloads.StopRequest{
SoftStopTimeoutSeconds: to.Ptr[int64](0),
},
})
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.OperationStatusResult = armworkloads.OperationStatusResult{
// Name: to.Ptr("app01"),
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()),
// Status: to.Ptr("Succeeded"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Stops the SAP Application Server Instance.
*
* @summary Stops the SAP Application Server Instance.
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json
*/
async function stopTheSapApplicationServerInstance() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const applicationInstanceName = "app01";
const body = { softStopTimeoutSeconds: 0 };
const options = {
body,
};
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPApplicationServerInstances.beginStopInstanceAndWait(
resourceGroupName,
sapVirtualInstanceName,
applicationInstanceName,
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.Models;
using Azure.ResourceManager.Workloads;
using Azure.ResourceManager.Workloads.Models;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json
// this example is just showing the usage of "SAPApplicationServerInstances_StopInstance" 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 SapApplicationServerInstanceResource created on azure
// for more information of creating SapApplicationServerInstanceResource, please refer to the document of SapApplicationServerInstanceResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
string sapVirtualInstanceName = "X00";
string applicationInstanceName = "app01";
ResourceIdentifier sapApplicationServerInstanceResourceId = SapApplicationServerInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sapVirtualInstanceName, applicationInstanceName);
SapApplicationServerInstanceResource sapApplicationServerInstance = client.GetSapApplicationServerInstanceResource(sapApplicationServerInstanceResourceId);
// invoke the operation
SapStopContent content = new SapStopContent()
{
SoftStopTimeoutSeconds = 0,
};
ArmOperation<OperationStatusResult> lro = await sapApplicationServerInstance.StopInstanceAsync(WaitUntil.Completed, content: content);
OperationStatusResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue