Haal de Query-Store queryteksten op voor opgegeven queryIds.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/queryTexts?api-version=2018-06-01&queryIds={queryIds}
URI-parameters
Name |
In |
Vereist |
Type |
Description |
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
De naam van de resourcegroep. De naam is niet hoofdlettergevoelig.
|
serverName
|
path |
True
|
string
|
De naam van de server.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
De id van het doelabonnement.
|
api-version
|
query |
True
|
string
minLength: 1
|
De API-versie die voor deze bewerking moet worden gebruikt.
|
queryIds
|
query |
True
|
string[]
|
De query-id's
|
Antwoorden
Name |
Type |
Description |
200 OK
|
QueryTextsResultList
|
OK
|
Other Status Codes
|
CloudError
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
QueryTextsListByServer
Voorbeeldaanvraag
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts?api-version=2018-06-01&queryIds=1&queryIds=2
import com.azure.core.util.Context;
import java.util.Arrays;
/** Samples for QueryTexts ListByServer. */
public final class Main {
/*
* x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json
*/
/**
* Sample code: QueryTextsListByServer.
*
* @param manager Entry point to MySqlManager.
*/
public static void queryTextsListByServer(com.azure.resourcemanager.mysql.MySqlManager manager) {
manager
.queryTexts()
.listByServer("testResourceGroupName", "testServerName", Arrays.asList("1", "2"), 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 typing import List
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.mysql import MySQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python query_texts_list_by_server.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 = MySQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.query_texts.list_by_server(
resource_group_name="testResourceGroupName",
server_name="testServerName",
query_ids=["1", "2"],
)
for item in response:
print(item)
# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/QueryTextsListByServer.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 armmysql_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json
func ExampleQueryTextsClient_NewListByServerPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armmysql.NewQueryTextsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := client.NewListByServerPager("testResourceGroupName",
"testServerName",
[]string{
"1",
"2"},
nil)
for pager.More() {
nextResult, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range nextResult.Value {
// TODO: use page item
_ = v
}
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MySQLManagementClient } = require("@azure/arm-mysql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieve the Query-Store query texts for specified queryIds.
*
* @summary Retrieve the Query-Store query texts for specified queryIds.
* x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json
*/
async function queryTextsListByServer() {
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = "testResourceGroupName";
const serverName = "testServerName";
const queryIds = ["1", "2"];
const credential = new DefaultAzureCredential();
const client = new MySQLManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.queryTexts.listByServer(resourceGroupName, serverName, queryIds)) {
resArray.push(item);
}
console.log(resArray);
}
queryTextsListByServer().catch(console.error);
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.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.MySql;
// Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/QueryTextsListByServer.json
// this example is just showing the usage of "QueryTexts_ListByServer" 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 MySqlServerResource created on azure
// for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "testResourceGroupName";
string serverName = "testServerName";
ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId);
// get the collection of this MySqlQueryTextResource
MySqlQueryTextCollection collection = mySqlServer.GetMySqlQueryTexts();
// invoke the operation and iterate over the result
IEnumerable<string> queryIds = new string[] { "1", "2" };
await foreach (MySqlQueryTextResource item in collection.GetAllAsync(queryIds))
{
// the variable item 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
MySqlQueryTextData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Voorbeeldrespons
{
"value": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts/1",
"name": "1",
"type": "Microsoft.DBforMySQL/servers/queryTexts",
"properties": {
"queryId": "1",
"queryText": "UPDATE `performance_schema`.`setup_instruments` SET `ENABLED` = ? , `TIMED` = ? WHERE NAME = ?"
}
},
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts/2",
"name": "2",
"type": "Microsoft.DBforMySQL/servers/queryTexts",
"properties": {
"queryId": "2",
"queryText": "UPDATE `performance_schema`.`setup_instruments` SET `ENABLED` = ? , `TIMED` = ? WHERE NAME LIKE ?"
}
}
]
}
Definities
CloudError
Object
Een foutreactie van de Batch-service.
Name |
Type |
Description |
error
|
ErrorResponse
|
Foutreactie
Veelvoorkomende foutreactie voor alle Azure Resource Manager-API's om foutdetails te retourneren voor mislukte bewerkingen. (Dit volgt ook de OData-foutreactie-indeling.)
|
ErrorAdditionalInfo
Object
Aanvullende informatie over de resourcebeheerfout.
Name |
Type |
Description |
info
|
object
|
De aanvullende informatie.
|
type
|
string
|
Het extra informatietype.
|
ErrorResponse
Object
Foutreactie
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
De fout bevat aanvullende informatie.
|
code
|
string
|
De foutcode.
|
details
|
ErrorResponse[]
|
De foutdetails.
|
message
|
string
|
Het foutbericht.
|
target
|
string
|
Het foutdoel.
|
QueryText
Object
Vertegenwoordigt een querytekst.
Name |
Type |
Description |
id
|
string
|
Volledig gekwalificeerde resource-id voor de resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
De naam van de resource
|
properties.queryId
|
string
|
Een query-id die uniek is voor de server.
|
properties.queryText
|
string
|
Querytekst.
|
type
|
string
|
Het type resource. Bijvoorbeeld 'Microsoft.Compute/virtualMachines' of 'Microsoft.Storage/storageAccounts'
|
QueryTextsResultList
Object
Een lijst met queryteksten.
Name |
Type |
Description |
nextLink
|
string
|
Koppeling om de volgende pagina met resultaten op te halen.
|
value
|
QueryText[]
|
De lijst met queryteksten.
|