Áthelyezi a kérelem törzsében található erőforráskészletet. Az áthelyezési művelet akkor aktiválódik, ha a moveResources a MovePending vagy a MoveFailed moveState állapotban van, a sikeres végrehajtás után a moveResource moveState áttűnést hajt végre a CommitPendingre. Annak érdekében, hogy segítse a felhasználót a művelet előfeltételeinek eléréséhez, az ügyfél meghívhatja a műveletet a validateOnly tulajdonság true (igaz) értékre állításával.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove?api-version=2023-08-01
URI-paraméterek
Name |
In |
Kötelező |
Típus |
Description |
moveCollectionName
|
path |
True
|
string
|
Az áthelyezési gyűjtemény neve.
|
resourceGroupName
|
path |
True
|
string
|
Az erőforráscsoport neve.
|
subscriptionId
|
path |
True
|
string
|
Az előfizetés azonosítója.
|
api-version
|
query |
True
|
string
|
Client API-verzió.
|
Kérelem törzse
Name |
Kötelező |
Típus |
Description |
moveResources
|
True
|
string[]
|
Lekéri vagy beállítja az erőforrás-azonosítók listáját, alapértelmezés szerint elfogadja az áthelyezési erőforrás-azonosítókat, kivéve, ha a bemeneti típust a moveResourceInputType tulajdonságon keresztül váltja.
|
moveResourceInputType
|
|
MoveResourceInputType
|
Meghatározza az áthelyezési erőforrás bemeneti típusát.
|
validateOnly
|
|
boolean
|
Lekéri vagy beállít egy értéket, amely jelzi, hogy a műveletnek csak az előfeltételt kell-e futtatnia.
|
Válaszok
Name |
Típus |
Description |
200 OK
|
OperationStatus
|
OK
|
202 Accepted
|
|
Elfogadva
|
Other Status Codes
|
CloudError
|
Hibaválasz, amely leírja, hogy a művelet miért hiúsult meg.
|
Biztonság
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
felhasználói fiók megszemélyesítése
|
Példák
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
Definíciók
AffectedMoveResource
Az egyéni RP-művelet hibaadatai.
Name |
Típus |
Description |
id
|
string
|
Az érintett áthelyezési erőforrás azonosítója.
|
moveResources
|
AffectedMoveResource[]
|
Az érintett erőforrások áthelyezése.
|
sourceId
|
string
|
Az érintett áthelyezési erőforrás forrásazonosítója.
|
CloudError
Hibaválasz a szolgáltatástól.
CloudErrorBody
Hibaválasz a szolgáltatástól.
Name |
Típus |
Description |
code
|
string
|
A hiba azonosítója. A kódok invariánsak, és programozott módon használhatók.
|
details
|
CloudErrorBody[]
|
A hibával kapcsolatos további részletek listája.
|
message
|
string
|
A hibát leíró üzenet, amely alkalmas a felhasználói felületen való megjelenítésre.
|
target
|
string
|
Az adott hiba célja. Például a hibás tulajdonság neve.
|
MoveErrorInfo
Az áthelyezési egyéni hibaadatok.
Meghatározza az áthelyezési erőforrás bemeneti típusát.
Name |
Típus |
Description |
MoveResourceId
|
string
|
|
MoveResourceSourceId
|
string
|
|
OperationErrorAdditionalInfo
A művelet hibaadatai.
Name |
Típus |
Description |
info
|
MoveErrorInfo
|
A művelet hibaadatai.
|
type
|
string
|
A hiba típusa.
|
OperationStatus
A művelet állapota REST-erőforrás.
Name |
Típus |
Description |
endTime
|
string
|
Befejezés időpontja.
|
error
|
OperationStatusError
|
Hiba a művelet összes hibarészletének megadásakor.
|
id
|
string
|
Erőforrás-azonosító.
|
name
|
string
|
A művelet neve.
|
properties
|
OperationStatusProperties
|
Egyéni adatok.
|
startTime
|
string
|
Kezdési időpont.
|
status
|
string
|
A művelet állapota. Az ARM arra számít, hogy a terminál állapota a Sikeres/Sikertelen/Megszakítva állapotú lesz. Minden más érték azt jelenti, hogy a művelet még fut.
|
OperationStatusError
A műveleti állapot hibáinak osztálya.
OperationStatusProperties
A művelet eredménytulajdonságainak osztálya.
ResourceMoveRequest
Meghatározza az erőforrás-áthelyezési művelet kérelemtörzsét.
Name |
Típus |
Description |
moveResourceInputType
|
MoveResourceInputType
|
Meghatározza az áthelyezési erőforrás bemeneti típusát.
|
moveResources
|
string[]
|
Lekéri vagy beállítja az erőforrás-azonosítók listáját, alapértelmezés szerint elfogadja az áthelyezési erőforrás-azonosítókat, kivéve, ha a bemeneti típust a moveResourceInputType tulajdonságon keresztül váltja.
|
validateOnly
|
boolean
|
Lekéri vagy beállít egy értéket, amely jelzi, hogy a műveletnek csak az előfeltételt kell-e futtatnia.
|