GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/29dd7459-4a7c-4e56-be22-f0adda49440d?api-version=2014-04-01
import com.azure.core.util.Context;
/** Samples for ServiceObjectives Get. */
public final class Main {
/*
* x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json
*/
/**
* Sample code: Get a service objective.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAServiceObjective(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.sqlServers()
.manager()
.serviceClient()
.getServiceObjectives()
.getWithResponse("group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", 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.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python service_objective_get.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 = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)
response = client.service_objectives.get(
resource_group_name="group1",
server_name="sqlcrudtest",
service_objective_name="29dd7459-4a7c-4e56-be22-f0adda49440d",
)
print(response)
# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.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 armsql_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fe78d8f1e7bd86c778c7e1cafd52cb0e9fec67ef/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json
func ExampleServiceObjectivesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsql.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServiceObjectivesClient().Get(ctx, "group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", 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.ServiceObjective = armsql.ServiceObjective{
// Name: to.Ptr("29dd7459-4a7c-4e56-be22-f0adda49440d"),
// Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"),
// ID: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/serviceObjectives/29dd7459-4a7c-4e56-be22-f0adda49440d"),
// Properties: &armsql.ServiceObjectiveProperties{
// Enabled: to.Ptr(false),
// IsDefault: to.Ptr(false),
// IsSystem: to.Ptr(true),
// ServiceObjectiveName: to.Ptr("System0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a database service objective.
*
* @summary Gets a database service objective.
* x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json
*/
async function getAServiceObjective() {
const subscriptionId =
process.env["SQL_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444";
const resourceGroupName = process.env["SQL_RESOURCE_GROUP"] || "group1";
const serverName = "sqlcrudtest";
const serviceObjectiveName = "29dd7459-4a7c-4e56-be22-f0adda49440d";
const credential = new DefaultAzureCredential();
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.serviceObjectives.get(
resourceGroupName,
serverName,
serviceObjectiveName
);
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.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json
// this example is just showing the usage of "ServiceObjectives_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 SqlServerResource created on azure
// for more information of creating SqlServerResource, please refer to the document of SqlServerResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "group1";
string serverName = "sqlcrudtest";
ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId);
// get the collection of this ServiceObjectiveResource
ServiceObjectiveCollection collection = sqlServer.GetServiceObjectives();
// invoke the operation
string serviceObjectiveName = "29dd7459-4a7c-4e56-be22-f0adda49440d";
bool result = await collection.ExistsAsync(serviceObjectiveName);
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