すべてのプロダクト
Search
ドキュメントセンター

:CreateResourceShare

最終更新日:Oct 13, 2025

共有ユニットを作成します。

操作説明

Alibaba Cloud リソース共有を使用すると、アカウントから指定したリソースを 1 つ以上の宛先アカウントと共有できます。詳細については、「リソース共有の概要」をご参照ください。

このトピックでは、cn-hangzhou リージョンのリソースディレクトリの管理アカウントを使用して、test という名前の共有ユニットを作成し、vSwitch vsw-bp183p93qs667muql**** をリソースディレクトリのメンバー 172050525300**** と共有する方法の例を示します。

今すぐお試しください

この API を OpenAPI Explorer でお試しください。手作業による署名は必要ありません。呼び出しに成功すると、入力したパラメーターに基づき、資格情報が組み込まれた SDK コードが自動的に生成されます。このコードをダウンロードしてローカルで使用できます。

テスト

RAM 認証

下表に、この API を呼び出すために必要な認証情報を示します。認証情報は、RAM (Resource Access Management) ポリシーを使用して定義できます。以下で各列名について説明します。

  • アクション:特定のリソースに対して実行可能な操作。ポリシー構文ではAction要素として指定します。

  • API:アクションを具体的に実行するための API。

  • アクセスレベル:各 API に対して事前定義されているアクセスの種類。有効な値:create、list、get、update、delete。

  • リソースタイプ:アクションが作用するリソースの種類。リソースレベルでの権限をサポートするかどうかを示すことができます。ポリシーの有効性を確保するため、アクションの対象として適切なリソースを指定してください。

    • リソースレベルの権限を持つ API の場合、必要なリソースタイプはアスタリスク (*) でマークされます。ポリシーのResource要素で対応する ARN を指定してください。

    • リソースレベルの権限を持たない API の場合、「すべてのリソース」と表示され、ポリシーのResource要素でアスタリスク (*) でマークされます。

  • 条件キー:サービスによって定義された条件のキー。このキーにより、きめ細やかなアクセス制御が可能になります。この制御は、アクション単体に適用することも、特定のリソースに対するアクションに適用することもできます。Alibaba Cloud は、サービス固有の条件キーに加えて、すべての RAM 統合サービスに適用可能な一連の共通条件キーを提供しています。

  • 依存アクション:ある特定のアクションを実行するために、前提として実行が必要となる他のアクション。依存アクションの権限も RAM ユーザーまたは RAM ロールに付与する必要があります。

アクション

アクセスレベル

リソースタイプ

条件キー

依存アクション

resourcesharing:CreateResourceShare

create

*All Resource

*

  • resourcesharing:RequestedAllowExternalTargets
  • resourcesharing:Target
  • resourcesharing:RequestedResourceType
  • resourcesharing:ResourceArn
なし

リクエストパラメーター

パラメーター

必須 / 任意

説明

ResourceShareName

string

必須

共有ユニットの名前。

名前の長さは 1 ~ 50 文字である必要があります。

名前には、文字、数字、漢字、ピリオド (.)、アンダースコア (_)、ハイフン (-) を使用できます。

test

Resources

array<object>

任意

共有リソース。

object

任意

共有リソース。

ResourceId

string

任意

共有リソースの ID。

N の値は 1 ~ 5 です。これは、一度に最大 5 つの共有リソースを追加できることを意味します。

説明

Resources.N.ResourceIdResources.N.ResourceType はペアで指定する必要があります。

vsw-bp183p93qs667muql****

ResourceType

string

任意

共有リソースのタイプ。

N の値は 1 ~ 5 です。これは、一度に最大 5 つの共有リソースを追加できることを意味します。

共有可能なリソースタイプの詳細については、「リソース共有と連携するサービス」をご参照ください。

説明

Resources.N.ResourceIdResources.N.ResourceType はペアで指定する必要があります。

VSwitch

Targets

array

任意

プリンシパル。

172050525300****

string

任意

プリンシパル。有効な値:

  • AllowExternalTargetsfalse に設定されている場合、プリンシパルはリソースディレクトリの ID、フォルダの ID、またはメンバーの ID になります。

  • AllowExternalTargetstrue に設定されている場合、プリンシパルは Alibaba Cloud アカウントの ID、リソースディレクトリの ID、フォルダの ID、メンバーの ID、または Alibaba Cloud サービスの名前にすることができます。

詳細については、「リソース共有の仕組み」、「リソースディレクトリの基本情報を表示する」、「フォルダの基本情報を表示する」、または「メンバーの基本情報を表示する」をご参照ください。

N の値は 1 ~ 5 です。これは、一度に最大 5 つのプリンシパルを追加できることを意味します。

172050525300****

ResourceArns

array

任意

共有リソースの Alibaba Cloud リソースネーム (ARN)。

N の値は 1 ~ 5 です。これは、一度に最大 5 つの共有リソースを追加できることを意味します。

string

任意

共有リソースの ARN。

説明

ARN のフォーマットの詳細については、「リソース共有と連携するサービス」をご参照ください。

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

PermissionNames

array

任意

権限の名前。このパラメーターを空のままにすると、システムは自動的にデフォルトの権限をリソースタイプに関連付けます。詳細については、「権限ライブラリ」をご参照ください。

string

任意

権限の名前。このパラメーターが空の場合、システムはリソースタイプのデフォルトの権限をアタッチします。詳細については、「権限ライブラリ」をご参照ください。

AliyunRSDefaultPermissionVSwitch

AllowExternalTargets

boolean

任意

リソースディレクトリ外のアカウントとリソースを共有するかどうかを指定します。有効な値:

  • false (デフォルト): リソースはリソースディレクトリ内のアカウントとのみ共有できます。

  • true: リソースは任意のアカウントと共有できます。

false

ResourceGroupId

string

任意

リソースグループの ID。

rg-aekz5nlvlak****

TargetProperties

array<object>

任意

プリンシパルのプロパティ。

説明

このパラメーターは、プリンシパルが Alibaba Cloud サービスの場合にのみ設定できます。

object

任意

プリンシパルのプロパティ。

説明

このパラメーターは、プリンシパルが Alibaba Cloud サービスの場合にのみ設定できます。

Property

string

任意

プリンシパルのプロパティ。たとえば、リソース共有の時間範囲を指定できます。timeRangeType の有効な値:

  • timeRange: 指定された時間範囲。

  • day: 終日。

説明

TargetProperties.N.TargetIdTargetProperties.N.Property はペアで指定する必要があります。

{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } }

TargetId

string

任意

プリンシパルの ID。

説明

TargetProperties.N.TargetIdTargetProperties.N.Property はペアで指定する必要があります。

172050525300****

Tag

array<object>

任意

タグ。最大 20 個のタグを追加できます。

object

任意

タグ。

Key

string

任意

タグキー。

説明

タグキーの長さは最大 128 文字です。aliyun または acs: で始めることはできず、http:// または https:// を含めることはできません。

k1

Value

string

任意

タグの値。

説明

タグの値の長さは最大 128 文字です。acs: で始めることはできず、http:// または https:// を含めることはできません。

v1

レスポンスフィールド

フィールド

説明

object

レスポンスパラメーター。

RequestId

string

リクエストの ID。

2C3FA051-61DC-4F3E-81E9-E4830524DF4B

ResourceShare

object

共有ユニットに関する情報。

AllowExternalTargets

boolean

共有ユニット内のリソースをリソースディレクトリ外のアカウントと共有できるかどうかを示します。有効な値:

  • false: リソースはリソースディレクトリ内のアカウントとのみ共有できます。

  • true: リソースは任意のアカウントと共有できます。

false

CreateTime

string

共有ユニットが作成された時間。

2020-12-03T08:02:22.413Z

ResourceShareId

string

共有ユニットの ID。

rs-qSkW1HBY****

ResourceShareName

string

共有ユニットの名前。

test

ResourceShareOwner

string

共有ユニットのオーナー。

151266687691****

ResourceShareStatus

string

共有ユニットのステータス。有効な値:

  • Active: 共有ユニットは有効です。

  • Pending: 共有ユニットは確認待ちです。

  • Deleting: 共有ユニットは削除中です。

  • Deleted: 共有ユニットは削除されました。

説明

Deleted 状態の共有ユニットは、48 ~ 96 時間以内にシステムによって自動的に削除されます。

Active

UpdateTime

string

共有ユニットが更新された時間。

2020-12-03T08:02:22.413Z

成功レスポンス

JSONJSON

{
  "RequestId": "2C3FA051-61DC-4F3E-81E9-E4830524DF4B",
  "ResourceShare": {
    "AllowExternalTargets": false,
    "CreateTime": "2020-12-03T08:02:22.413Z",
    "ResourceShareId": "rs-qSkW1HBY****",
    "ResourceShareName": "test",
    "ResourceShareOwner": "151266687691****",
    "ResourceShareStatus": "Active",
    "UpdateTime": "2020-12-03T08:02:22.413Z"
  }
}

エラーコード

HTTP ステータスコード

エラーコード

エラーメッセージ

説明

400 InvalidParameter.ResourceShareName The ResourceShareName is invalid. The ResourceShareName is invalid.
400 InvalidParameter.ResourceShareName.Length The maximum length of ResourceShareName exceeds 50 characters. The maximum length of ResourceShareName exceeds 50 characters.
400 InvalidParameter.Resources The Resources is invalid. The Resources is invalid.
400 InvalidParameter.Resources.Duplicate The Resources contains duplicate values. The Resources contains duplicate values.
400 InvalidParameter.Resources.Length The maximum number of Resources exceeds 5. The maximum number of Resources exceeds 5.
400 InvalidParameter.Targets The Targets is invalid. The Targets is invalid.
400 InvalidParameter.Targets.Duplicate The Targets contains duplicate values. The Targets contains duplicate values.
400 InvalidParameter.Targets.Length The maximum number of Targets exceeds 5. The maximum number of Targets exceeds 5.
400 InvalidTarget The shared target does not exist in the resource directory. The target you are sharing does not exist in your resource directory.
400 InvalidParameter The specified parameter is invalid. The specified parameter is invalid.
400 MissingParameter.ResourceShareName You must specify ResourceShareName. You must specify ResourceShareName.
400 InvalidParameter.ResourceType The ResourceType is invalid. The ResourceType is invalid.
400 InvalidParameter.PermissionNames.Duplicate The PermissionNames duplicate values.
400 InvalidParameter.PermissionNames.Length The maximum length of PermissionNames exceeds quota limit.
400 InvalidParameter.TargetProperties The TargetProperties is invalid.
400 InvalidParameter.TargetProperties.Duplicate The TargetProperties contains duplicate values.
400 InvalidParameter.TargetProperties.Length The TargetProperties beyond the length limit.
400 InvalidParameter.ResourceArns The ResourceArns is invalid.
400 InvalidParameter.ResourceArns.Duplicate The ResourceArns contains duplicate values.
400 InvalidParameter.ResourceArns.Length The ResourceArns beyond the length limit.
400 InvalidParameter.ResourceConflict Both Resources and ResourceArns cannot be specified simultaneously. Please provide only one of these parameters.
400 NotSupport.ResourceType.ResourcesParameter The Resources parameter does not support this resource type. Please use ResourceArns instead.
404 EntityNotExists.Permission The resource share permission does not exist.
409 NotEnableSharingWithResourceDirectory You have not enabled sharing with your Resource Directory.
409 AccountNotInResourceDirectory The account is not a master or a member of a resource directory. The account is not a master or a member of a resource directory.
409 QuotaExceeded.ResourceShare.Count The maximum number of ResourceShare exceeds the limit. The maximum number of ResourceShare exceeds the limit.
409 EntityAlreadyExists.ResourceShare The specified resource share ID already exists. The specified resource share ID already exists.
409 QuotaExceeded.SharedResource.Count The maximum number of shared resources per account exceeds the limit. The maximum number of shared resources per account exceeds the limit.
409 ShareWithYourself You cannot share resources with yourself. You cannot share resources with yourself.
409 NotManagementAccount Only the management account of the service is allowed to share such resources.
409 QuotaExceeded.PendingInvitations The maximum number of pending invitations exceeds the limit.
409 InvalidTarget.LegalEntityMismatch The target account does not have the same legal entity as the resource owner account.
409 ExternalTargetsNotAllowed.ResourceType The resource share includes resource types that cannot be shared with accounts outside the resource directory.
409 InvalidTarget.SiteMismatch Cross-site resource sharing is not supported.
409 NotSupport.Service.ExistInOtherResourceShare The resource type has been shared to the target service through other resourceShare. Please share it in the same resourceShare.
409 NotSupport.Service.AssociateConflict The same resource cannot be shared repeatedly to the target service.

完全なリストについては、「エラーコード」をご参照ください。

変更履歴

完全なリストについては、「変更履歴」をご参照ください。