PROJECT_ID는 마이그레이션하려는 프로젝트의 고유 프로젝트 ID입니다. 예를 들면 --myProject123입니다.
FOLDER_ID는 분석을 실행할 대상 폴더의 숫자 폴더 ID입니다.
예를 들면 45678901123입니다.
ORGANIZATION_ID는 분석을 실행할 대상 조직의 숫자 조직 ID입니다.
예를 들면 78901123456입니다.
API
이동을 수행하지 않고 리소스 계층 구조의 현재 위치에서 프로젝트를 마이그레이션할 때의 영향을 분석하려면 cloudasset.analyzeMove 메서드를 사용합니다.
GET https://cloudasset.googleapis.com/v1/{resource=*/*}: \
analyzeMove?destinationParent=DESTINATION_NAME
각 항목의 의미는 다음과 같습니다.
resource는 분석을 수행할 리소스의 이름입니다. 프로젝트 리소스만 지원되므로 프로젝트 ID 또는 프로젝트 번호여야 합니다. 예를 들면 projects/my-project-id 또는 projects/12345입니다.
DESTINATION_NAME은 대상 리소스의 상위 항목을 변경할 Google Cloud 폴더 또는 조직 리소스의 이름입니다. 지정된 대상 상위 항목으로 리소스를 이동할 때의 영향에 대해 분석이 수행됩니다. 대상은 폴더 번호 또는 조직 리소스 번호여야 합니다.
예를 들면 folders/123 또는 organizations/123입니다.
이동 분석 응답
Move Analysis API에서 받은 응답은 서비스 이름별로 그룹화됩니다.
각 서비스 아래에는 이 프로젝트 마이그레이션에 적용되는 경고와 차단 목록이 있습니다. 이 분석에 의해 반환되는 차단 문제는 이를 해결하기 전에 이동을 진행하는 경우 런타임에서 프로젝트 마이그레이션이 차단된다는 의미입니다.
오류 해결
Move Analysis API에서 반환된 오류가 있으면 표준 gRPC 코드 및 Move Analysis API를 통한 프로젝트 분석이 실패한 이유를 설명하는 메시지가 포함됩니다.
다음 표에서는 Move Analysis API에서 반환될 수 있는 오류 코드를 설명합니다.
오류 이름
오류 코드
설명
잘못된 인수
3
잘못된 리소스 이름과 같이 잘못된 인수가 있는 프로젝트에서 API를 호출하면 반환됩니다.
권한 거부됨
7
분석을 수행하는 데 필요한 권한이 없거나 소스 프로젝트가 없으면 반환됩니다.
내부
13
Identity and Access Management와 같은 정책 시스템 호출 또는 조직 정책과 관련된 문제가 있으면 반환됩니다. 그렇다고 해서 마이그레이션이 불가능하다는 것을 의미하지는 않으며 서비스 중단을 확인한 후 분석을 다시 시도할 수 있습니다.
사용할 수 없음
14
내부 시스템이 동기화되지 않으면 반환됩니다.
마이그레이션할 수 없다는 의미는 아니며 분석을 다시 시도할 수 있습니다.
인증되지 않음
16
이 분석을 수행할 올바른 사용자 인증 정보를 제공하지 않은 경우 반환됩니다.
오류 메시지 예시
다음 예시에서는 마이그레이션할 프로젝트에 대한 cloudasset.assets.analyzeMove 권한이 없는 사용자에게 반환되는 오류 코드를 보여줍니다.
{
"error": {
"code": 403,
"message": "Failed to fetch Project: projects/test-project-service-3 to perform
move analysis.",
"status": "PERMISSION_DENIED"}
}
일부 정책 시스템은 리소스 이동을 분석하지 못할 수 있습니다. 다음 예시에서는 사용자에게 마이그레이션할 프로젝트에 대한 compute.organizations.setSecurityPolicy 권한이 없는 경우 계층식 방화벽 서비스에서 반환되는 오류를 보여줍니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-21(UTC)"],[],[],null,["# Analyze project move\n\nThis guide describes how to use the Cloud Asset Inventory Analyze Move API to get a\ndetailed report on warnings and blockers from a list of critical policies\nsystems prior to actually moving your project.\n\nEnable APIs\n-----------\n\nSelect or create a project as your API consumer project, enable\n[Cloud Asset API](https://console.cloud.google.com/apis/library/cloudasset.googleapis.com)\n\nThis consumer project can be different from the project you plan to analyze and\nmigrate. Consumer project will be used to generate credentials to make API\nrequest.\n\nThe next section describes the required roles and permissions that must be\ngranted on the source project you plan to analyze.\n\nRequired permissions\n--------------------\n\nTo perform a project move analysis, you need a role that grants the\n`cloudasset.assets.analyzeMove` permission, such as **Cloud Asset Viewer** or\n**Viewer**.\n\nTo receive analysis on a service, you also need roles related to those services.\nThese permissions include the following:\n\n- If you want to view the inherited allow policies from the source\n project's parent organization resource, you need the\n `resourcemanager.organizations.getIamPolicy` permission on the\n source project's parent organization resource.\n\n- If you want to view the inherited allow policies from the source\n project's parent folder, you need the `resourcemanager.folders.getIamPolicy`\n permission on the source project's parent folder.\n\n- If you want to view the allow policies on the project,\n you need the `resourcemanager.projects.getIamPolicy` permission on the source\n project.\n\n- If you want to view the inherited deny policies from the source\n project's parent organization resource, you need the `iam.denypolicies.get`\n permission on the source project's parent organization resource.\n\n- If you want to view the organization policies that are inherited on this\n project, you need the `orgpolicy.policy.get` permission on the source project.\n\n- If you want to view the Compute Engine firewall policies that are inherited\n on this project, you need the `compute.organizations.setSecurityPolicy`\n permission on the source folder or organization resource.\n\n- If you want to view the inherited tags on this project, you need the `resourcemanager.hierarchyNodes.listEffectiveTags` permission on the source project or its ancestor nodes.\n\nPerform the analysis\n--------------------\n\nYou can use the Google Cloud CLI or the API to analyze the migration of a\nresource from its current place in the resource hierarchy.\n**Note:** This API does not perform any checks on the destination organization resource. Even if the destination organization resource specified in the API call does not exist, the analysis of the project to be moved is still performed. \n\n### gcloud\n\n\nTo analyze the impacts of migrating a project from its current position in\nthe resource hierarchy, use the `gcloud asset analyze-move` command: \n\n```\ngcloud asset analyze-move --project=PROJECT_ID \\\n (--destination-folder=FOLDER_ID \\\n | --destination-organization=ORGANIZATION_ID)\n```\n\nTo analyze the impacts of moving a project to a different **folder** , run\nthe command with `--destination-folder`: \n\n```\ngcloud asset analyze-move --project=PROJECT_ID \\\n --destination-folder=FOLDER_ID\n```\n\nTo analyze the impacts of moving a project to a different **organization** ,\nrun the command with `--destination-organization`: \n\n```\ngcloud asset analyze-move --project=PROJECT_ID \\\n --destination-organization=ORGANIZATION_ID\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the unique project ID of the\n project you are migrating. For example, `--myProject123`.\n\n- \u003cvar translate=\"no\"\u003eFOLDER_ID\u003c/var\u003e is the numerical folder ID of the\n destination folder on which to perform the analysis.\n For example, `45678901123`.\n\n- \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e is the numerical organization\n ID of the destination organization on which to perform the analysis.\n For example, `78901123456`.\n\n| **Note:** Exactly one of \u003cvar translate=\"no\"\u003eFOLDER_ID\u003c/var\u003e or \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e must be specified.\n\n### API\n\n\nTo analyze the impacts of migrating a project from its current position in\nthe resource hierarchy without performing the move, use the\n[cloudasset.analyzeMove](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/analyzeMove) method: \n\n```\nGET https://cloudasset.googleapis.com/v1/{resource=*/*}: \\\n analyzeMove?destinationParent=DESTINATION_NAME\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eresource\u003c/var\u003e is the name of the resource on which to\n perform the analysis. Only project resources are supported, so this must\n be the Project ID or a Project Number. For example,\n `projects/my-project-id` or `projects/12345`.\n\n- \u003cvar translate=\"no\"\u003eDESTINATION_NAME\u003c/var\u003e is the name of the\n Google Cloud folder or organization resource to reparent the target\n resource. The analysis will be performed on the impacts of moving the\n resource to the specified destination parent. The destination must be\n a folder number or an organization resource number.\n For example, `folders/123` or `organizations/123`.\n\nMove analysis responses\n-----------------------\n\nThe response you receive from the Move Analysis API is grouped by service name.\nUnder each service is a list of warnings and blockers applicable to this\nproject migration. Any blockers being returned by this analysis means that the\nproject migration will be blocked at run time if you proceed with the move\nbefore resolving them.\n| **Note:** Analysis results may not include functionality for services and features that are in preview. If your projects are part of any preview, please refer to that feature's user guide.\n\nTroubleshooting errors\n----------------------\n\nIf there is an error returned by the Move Analysis API, it includes a standard\n[gRPC code](https://grpc.github.io/grpc/core/md_doc_statuscodes.html), as well\nas a message that describes the reason for the failure of the Move Analysis\nAPI to analyze the project.\n\nThe following table describes the error codes that could potentially be returned\nby the Move Analysis API:\n\n#### Example error message\n\nThe following example demonstrates the error code returned for a user that does\nnot have the `cloudasset.assets.analyzeMove` permission on the project to be migrated: \n\n {\n \"error\": {\n \"code\": 403,\n \"message\": \"Failed to fetch Project: projects/test-project-service-3 to perform\n move analysis.\",\n \"status\": \"PERMISSION_DENIED\"}\n }\n\nSome of the policy systems may fail to analyze the resource move. The following\nexample demonstrates the error returned from the Hierarchical Firewall service\nwhen the user does not have `compute.organizations.setSecurityPolicy`\npermission on the project to be migrated: \n\n {\n \"moveAnalysis\": [{\n \"displayName\": \"name hidden\",\n \"analysis\": {\n \"warnings\": [{\n \"detail\": \"details hidden\"\n }]\n }\n }, {\n \"displayName\": \"name hidden\",\n \"analysis\": {\n \"warnings\": [{\n \"detail\": \"details hidden\"\n }]\n }\n }, {\n \"displayName\": \"Hierarchical Firewall\",\n \"error\": {\n \"code\": 7,\n \"message\": \"Failed to retrieve inherited security policies to perform\n analysis. Required 'compute.organizations.setSecurityPolicy'\n permission for {resource ID}\"\n }}]\n }\n\nWhat's next\n-----------\n\nThe Move Analysis API provides details that help mitigate blockers and other\nissues when moving a project from one organization resource to another. For more\ninformation about migrating projects between organization resources, see\n[Migrating projects](/resource-manager/docs/project-migration)."]]