Przenosi zestaw zasobów uwzględnionych w treści żądania. Operacja przenoszenia jest wyzwalana, gdy element moveResources znajduje się w elemencie moveState "MovePending" lub "MoveFailed", po pomyślnym zakończeniu moveResource moveState wykona przejście do commitPending. Aby ułatwić użytkownikowi wymaganie wstępne operacji, klient może wywołać operację z właściwością validateOnly ustawioną na true.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove?api-version=2023-08-01
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
moveCollectionName
|
path |
True
|
string
|
Nazwa kolekcji przenoszenia.
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów.
|
subscriptionId
|
path |
True
|
string
|
Identyfikator subskrypcji.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API klienta.
|
Treść żądania
Nazwa |
Wymagane |
Typ |
Opis |
moveResources
|
True
|
string[]
|
Pobiera lub ustawia listę identyfikatorów zasobów. Domyślnie akceptuje identyfikator zasobu przenoszenia, chyba że typ wejściowy jest przełączany za pośrednictwem właściwości moveResourceInputType.
|
moveResourceInputType
|
|
MoveResourceInputType
|
Definiuje typ danych wejściowych zasobu przenoszenia.
|
validateOnly
|
|
boolean
|
Pobiera lub ustawia wartość wskazującą, czy operacja musi uruchamiać tylko wymagania wstępne.
|
Odpowiedzi
Nazwa |
Typ |
Opis |
200 OK
|
OperationStatus
|
OK
|
202 Accepted
|
|
Zaakceptowano
|
Other Status Codes
|
CloudError
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nazwa |
Opis |
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
MoveCollections_InitiateMove
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/moveCollections/movecollection1/initiateMove?api-version=2023-08-01
{
"validateOnly": false,
"moveResources": [
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1"
]
}
import com.azure.resourcemanager.resourcemover.models.ResourceMoveRequest;
import java.util.Arrays;
/** Samples for MoveCollections InitiateMove. */
public final class Main {
/*
* x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_InitiateMove.json
*/
/**
* Sample code: MoveCollections_InitiateMove.
*
* @param manager Entry point to ResourceMoverManager.
*/
public static void moveCollectionsInitiateMove(
com.azure.resourcemanager.resourcemover.ResourceMoverManager manager) {
manager
.moveCollections()
.initiateMove(
"rg1",
"movecollection1",
new ResourceMoveRequest()
.withValidateOnly(false)
.withMoveResources(
Arrays
.asList(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")),
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.resourcemover import ResourceMoverServiceAPI
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resourcemover
# USAGE
python move_collections_initiate_move.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 = ResourceMoverServiceAPI(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.move_collections.begin_initiate_move(
resource_group_name="rg1",
move_collection_name="movecollection1",
).result()
print(response)
# x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_InitiateMove.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 armresourcemover_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/resourcemover/armresourcemover"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_InitiateMove.json
func ExampleMoveCollectionsClient_BeginInitiateMove() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armresourcemover.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewMoveCollectionsClient().BeginInitiateMove(ctx, "rg1", "movecollection1", &armresourcemover.MoveCollectionsClientBeginInitiateMoveOptions{Body: &armresourcemover.ResourceMoveRequest{
MoveResources: []*string{
to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")},
ValidateOnly: to.Ptr(false),
},
})
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.OperationStatus = armresourcemover.OperationStatus{
// Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"),
// EndTime: to.Ptr("6/17/2020 6:45:56 AM"),
// ID: to.Ptr("/subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resourceGroups/RegionMoveRG-southcentralus-southeastasia/providers/Microsoft.Migrate/MoveCollections/MoveCollection-southcentralus-southeastasia/operations/1e4193c3-206e-4916-b124-1da16175eb0e"),
// Properties: map[string]any{
// },
// StartTime: to.Ptr("6/17/2020 6:45:55 AM"),
// 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 { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.
*
* @summary Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.
* x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_InitiateMove.json
*/
async function moveCollectionsInitiateMove() {
const subscriptionId = process.env["RESOURCEMOVER_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["RESOURCEMOVER_RESOURCE_GROUP"] || "rg1";
const moveCollectionName = "movecollection1";
const body = {
moveResources: [
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1",
],
validateOnly: false,
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new ResourceMoverServiceAPI(credential, subscriptionId);
const result = await client.moveCollections.beginInitiateMoveAndWait(
resourceGroupName,
moveCollectionName,
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.ResourceMover;
using Azure.ResourceManager.ResourceMover.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_InitiateMove.json
// this example is just showing the usage of "MoveCollections_InitiateMove" 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 MoverResourceSetResource created on azure
// for more information of creating MoverResourceSetResource, please refer to the document of MoverResourceSetResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string moverResourceSetName = "movecollection1";
ResourceIdentifier moverResourceSetResourceId = MoverResourceSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, moverResourceSetName);
MoverResourceSetResource moverResourceSet = client.GetMoverResourceSetResource(moverResourceSetResourceId);
// invoke the operation
MoverResourceMoveContent content = new MoverResourceMoveContent(new ResourceIdentifier[]
{
new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")
})
{
ValidateOnly = false,
};
ArmOperation<MoverOperationStatus> lro = await moverResourceSet.InitiateMoveAsync(WaitUntil.Completed, content: content);
MoverOperationStatus 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
Sample Response
{
"id": "/subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resourceGroups/RegionMoveRG-southcentralus-southeastasia/providers/Microsoft.Migrate/MoveCollections/MoveCollection-southcentralus-southeastasia/operations/1e4193c3-206e-4916-b124-1da16175eb0e",
"name": "1e4193c3-206e-4916-b124-1da16175eb0e",
"status": "Succeeded",
"startTime": "6/17/2020 6:45:55 AM",
"endTime": "6/17/2020 6:45:56 AM",
"error": null,
"properties": {}
}
Location: https://some.endpoint.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1?api-version=2022-11-01
Definicje
AffectedMoveResource
Informacje o błędzie operacji niestandardowej rp.
Nazwa |
Typ |
Opis |
id
|
string
|
Identyfikator zasobu przenoszenia, którego dotyczy problem.
|
moveResources
|
AffectedMoveResource[]
|
Zasoby przenoszenia, których dotyczy problem.
|
sourceId
|
string
|
Identyfikator źródła zasobu przenoszenia, którego dotyczy problem.
|
CloudError
Odpowiedź na błąd z usługi.
CloudErrorBody
Odpowiedź na błąd z usługi.
Nazwa |
Typ |
Opis |
code
|
string
|
Identyfikator błędu. Kody są niezmienne i mają być używane programowo.
|
details
|
CloudErrorBody[]
|
Lista dodatkowych szczegółów dotyczących błędu.
|
message
|
string
|
Komunikat opisujący błąd, który ma być odpowiedni do wyświetlania w interfejsie użytkownika.
|
target
|
string
|
Element docelowy określonego błędu. Na przykład nazwa właściwości w błędzie.
|
MoveErrorInfo
Informacje o błędzie niestandardowym przenoszenia.
Definiuje typ danych wejściowych zasobu przenoszenia.
Nazwa |
Typ |
Opis |
MoveResourceId
|
string
|
|
MoveResourceSourceId
|
string
|
|
OperationErrorAdditionalInfo
Informacje o błędzie operacji.
Nazwa |
Typ |
Opis |
info
|
MoveErrorInfo
|
Informacje o błędzie operacji.
|
type
|
string
|
Typ błędu.
|
OperationStatus
Zasób REST stanu operacji.
Nazwa |
Typ |
Opis |
endTime
|
string
|
Godzina zakończenia.
|
error
|
OperationStatusError
|
Błąd z informacją o wszystkich szczegółach błędu dla operacji.
|
id
|
string
|
Identyfikator zasobu.
|
name
|
string
|
nazwa operacji.
|
properties
|
OperationStatusProperties
|
Dane niestandardowe.
|
startTime
|
string
|
Godzina rozpoczęcia.
|
status
|
string
|
Stan operacji. Usługa ARM oczekuje, że stan terminalu będzie jedną z wartości Powodzenie/Niepowodzenie/Anulowane. Wszystkie inne wartości oznaczają, że operacja jest nadal uruchomiona.
|
OperationStatusError
Klasa błędów stanu operacji.
OperationStatusProperties
Klasa właściwości wyniku operacji.
ResourceMoveRequest
Definiuje treść żądania dla operacji przenoszenia zasobów.
Nazwa |
Typ |
Opis |
moveResourceInputType
|
MoveResourceInputType
|
Definiuje typ danych wejściowych zasobu przenoszenia.
|
moveResources
|
string[]
|
Pobiera lub ustawia listę identyfikatorów zasobów. Domyślnie akceptuje identyfikator zasobu przenoszenia, chyba że typ wejściowy jest przełączany za pośrednictwem właściwości moveResourceInputType.
|
validateOnly
|
boolean
|
Pobiera lub ustawia wartość wskazującą, czy operacja musi uruchamiać tylko wymagania wstępne.
|