create-allocation
restish dci create-allocation
Creates a new allocation.
Requestโ
Content-Type: application/json
Schemaโ
{
"required": [
"name",
"description"
],
"type": "object",
"description": "Request body for creating an allocation.",
"properties": {
"name": {
"type": "string",
"description": "Allocation name."
},
"description": {
"type": "string",
"description": "Allocation description."
},
"rule": {
"required": [
"components",
"formula"
],
"type": "object",
"description": "Single allocation rule. Components can reference other existing allocation rules by using the \"allocation_rule\" dimension type.",
"nullable": true,
"properties": {
"components": {
"type": "array",
"description": "List of allocation filter components.",
"items": {
"required": [
"key",
"type",
"values",
"mode"
],
"type": "object",
"description": "A filter component used inside allocation rules.\nWhen the type is \"allocation_rule\", the component references existing allocation rules (nested allocation rules).\nA maximum nesting depth of 3 levels is supported, and circular references are not allowed.",
"properties": {
"key": {
"type": "string",
"description": "Key of an existing dimension. Examples: \"billing_account_id\", \"country\". When type is \"allocation_rule\", the key must be set to \"allocation_rule\"."
},
"type": {
"description": "Enumeration of supported dimension/filter types for allocation components.",
"type": "string",
"enum": [
"datetime",
"fixed",
"optional",
"label",
"tag",
"project_label",
"system_label",
"allocation_rule",
"gke",
"gke_label"
]
},
"values": {
"type": "array",
"description": "Values to filter on. When type is \"allocation_rule\", the values are IDs of existing allocation rules.",
"items": {
"type": "string"
}
},
"inverse_selection": {
"type": "boolean",
"description": "If true, all selected values will be excluded.",
"default": false
},
"include_null": {
"type": "boolean",
"description": "Include null values.",
"default": false
},
"mode": {
"type": "string",
"description": "Filter mode to apply. When type is \"allocation_rule\", only \"is\" and \"contains\" modes are supported.",
"enum": [
"is",
"starts_with",
"ends_with",
"contains",
"regexp"
]
}
}
}
},
"formula": {
"type": "string",
"description": "Formula for combining components (A is the first component, B is the second one, etc.).",
"example": "A AND B"
}
}
},
"rules": {
"type": "array",
"items": {
"required": [
"action"
],
"type": "object",
"nullable": true,
"description": "Allocation rule for a group type allocation. Components can reference other existing allocation rules by using the \"allocation_rule\" dimension type.",
"properties": {
"name": {
"type": "string",
"description": "Name of the allocation rule."
},
"description": {
"type": "string",
"description": "Description of the allocation rule."
},
"action": {
"type": "string",
"description": "Action to perform with this rule.",
"enum": [
"create",
"update",
"select"
]
},
"id": {
"type": "string",
"description": "ID of existing allocation (required for 'update' or 'select' action)."
},
"components": {
"type": "array",
"description": "List of allocation filter components (required for 'create' or 'update' action). Can include components of type \"allocation_rule\" to reference existing allocation rules.",
"items": {
"required": [
"key",
"type",
"values",
"mode"
],
"type": "object",
"description": "A filter component used inside allocation rules.\nWhen the type is \"allocation_rule\", the component references existing allocation rules (nested allocation rules).\nA maximum nesting depth of 3 levels is supported, and circular references are not allowed.",
"properties": {
"key": {
"type": "string",
"description": "Key of an existing dimension. Examples: \"billing_account_id\", \"country\". When type is \"allocation_rule\", the key must be set to \"allocation_rule\"."
},
"type": {
"description": "Enumeration of supported dimension/filter types for allocation components.",
"type": "string",
"enum": [
"datetime",
"fixed",
"optional",
"label",
"tag",
"project_label",
"system_label",
"allocation_rule",
"gke",
"gke_label"
]
},
"values": {
"type": "array",
"description": "Values to filter on. When type is \"allocation_rule\", the values are IDs of existing allocation rules.",
"items": {
"type": "string"
}
},
"inverse_selection": {
"type": "boolean",
"description": "If true, all selected values will be excluded.",
"default": false
},
"include_null": {
"type": "boolean",
"description": "Include null values.",
"default": false
},
"mode": {
"type": "string",
"description": "Filter mode to apply. When type is \"allocation_rule\", only \"is\" and \"contains\" modes are supported.",
"enum": [
"is",
"starts_with",
"ends_with",
"contains",
"regexp"
]
}
}
}
},
"formula": {
"type": "string",
"description": "Formula for combining components (A is the first component, B is the second one, etc.)",
"example": "A AND B"
}
}
}
},
"unallocatedCosts": {
"type": "string",
"description": "Custom label for values that do not fit into allocation (required for group type allocation).",
"nullable": true
}
}
}
Responsesโ
200 (application/json)โ
OK - The request succeeded.
{
"type": "object",
"description": "Allocation object, including rules and metadata.",
"properties": {
"id": {
"type": "string",
"description": "Allocation ID."
},
"name": {
"type": "string",
"description": "Allocation name."
},
"description": {
"type": "string",
"description": "Allocation description."
},
"type": {
"type": "string",
"description": "Type of allocation (preset or custom)."
},
"allocationType": {
"type": "string",
"description": "Composition type of allocation.",
"enum": [
"single",
"group"
]
},
"createTime": {
"type": "integer",
"description": "The time when the allocation was created (in UNIX timestamp).",
"format": "int64"
},
"updateTime": {
"type": "integer",
"description": "Last time the allocation was modified (in UNIX timestamp).",
"format": "int64"
},
"anomalyDetection": {
"type": "boolean",
"description": "Whether anomaly detection is enabled for this allocation.",
"nullable": true
},
"rule": {
"required": [
"components",
"formula"
],
"type": "object",
"description": "Single allocation rule. Components can reference other existing allocation rules by using the \"allocation_rule\" dimension type.",
"nullable": true,
"properties": {
"components": {
"type": "array",
"description": "List of allocation filter components.",
"items": {
"required": [
"key",
"type",
"values",
"mode"
],
"type": "object",
"description": "A filter component used inside allocation rules.\nWhen the type is \"allocation_rule\", the component references existing allocation rules (nested allocation rules).\nA maximum nesting depth of 3 levels is supported, and circular references are not allowed.",
"properties": {
"key": {
"type": "string",
"description": "Key of an existing dimension. Examples: \"billing_account_id\", \"country\". When type is \"allocation_rule\", the key must be set to \"allocation_rule\"."
},
"type": {
"description": "Enumeration of supported dimension/filter types for allocation components.",
"type": "string",
"enum": [
"datetime",
"fixed",
"optional",
"label",
"tag",
"project_label",
"system_label",
"allocation_rule",
"gke",
"gke_label"
]
},
"values": {
"type": "array",
"description": "Values to filter on. When type is \"allocation_rule\", the values are IDs of existing allocation rules.",
"items": {
"type": "string"
}
},
"inverse_selection": {
"type": "boolean",
"description": "If true, all selected values will be excluded.",
"default": false
},
"include_null": {
"type": "boolean",
"description": "Include null values.",
"default": false
},
"mode": {
"type": "string",
"description": "Filter mode to apply. When type is \"allocation_rule\", only \"is\" and \"contains\" modes are supported.",
"enum": [
"is",
"starts_with",
"ends_with",
"contains",
"regexp"
]
}
}
}
},
"formula": {
"type": "string",
"description": "Formula for combining components (A is the first component, B is the second one, etc.).",
"example": "A AND B"
}
}
},
"rules": {
"type": "array",
"items": {
"required": [
"action"
],
"type": "object",
"nullable": true,
"description": "Allocation rule for a group type allocation. Components can reference other existing allocation rules by using the \"allocation_rule\" dimension type.",
"properties": {
"name": {
"type": "string",
"description": "Name of the allocation rule."
},
"description": {
"type": "string",
"description": "Description of the allocation rule."
},
"action": {
"type": "string",
"description": "Action to perform with this rule.",
"enum": [
"create",
"update",
"select"
]
},
"id": {
"type": "string",
"description": "ID of existing allocation (required for 'update' or 'select' action)."
},
"components": {
"type": "array",
"description": "List of allocation filter components (required for 'create' or 'update' action). Can include components of type \"allocation_rule\" to reference existing allocation rules.",
"items": {
"required": [
"key",
"type",
"values",
"mode"
],
"type": "object",
"description": "A filter component used inside allocation rules.\nWhen the type is \"allocation_rule\", the component references existing allocation rules (nested allocation rules).\nA maximum nesting depth of 3 levels is supported, and circular references are not allowed.",
"properties": {
"key": {
"type": "string",
"description": "Key of an existing dimension. Examples: \"billing_account_id\", \"country\". When type is \"allocation_rule\", the key must be set to \"allocation_rule\"."
},
"type": {
"description": "Enumeration of supported dimension/filter types for allocation components.",
"type": "string",
"enum": [
"datetime",
"fixed",
"optional",
"label",
"tag",
"project_label",
"system_label",
"allocation_rule",
"gke",
"gke_label"
]
},
"values": {
"type": "array",
"description": "Values to filter on. When type is \"allocation_rule\", the values are IDs of existing allocation rules.",
"items": {
"type": "string"
}
},
"inverse_selection": {
"type": "boolean",
"description": "If true, all selected values will be excluded.",
"default": false
},
"include_null": {
"type": "boolean",
"description": "Include null values.",
"default": false
},
"mode": {
"type": "string",
"description": "Filter mode to apply. When type is \"allocation_rule\", only \"is\" and \"contains\" modes are supported.",
"enum": [
"is",
"starts_with",
"ends_with",
"contains",
"regexp"
]
}
}
}
},
"formula": {
"type": "string",
"description": "Formula for combining components (A is the first component, B is the second one, etc.)",
"example": "A AND B"
}
}
}
},
"unallocatedCosts": {
"type": "string",
"description": "Custom label for values that do not fit into allocation (required for group type allocation).",
"nullable": true
}
}
}
400 (application/json)โ
Bad Request - The server cannot process the request, often due to a malformed request.
{
"type": "object",
"description": "Standard error response structure.",
"properties": {
"error": {
"type": "string",
"description": "Detailed error message."
}
}
}
401 (application/json)โ
Unauthorized - Invalid API key.
{
"type": "object",
"description": "Standard error response structure.",
"properties": {
"error": {
"type": "string",
"description": "Detailed error message."
}
}
}
403 (application/json)โ
Forbidden - The client is not authorized to perform the request.
{
"type": "object",
"description": "Standard error response structure.",
"properties": {
"error": {
"type": "string",
"description": "Detailed error message."
}
}
}
404 (application/json)โ
Not Found - The requested resource does not exist.
{
"type": "object",
"description": "Standard error response structure.",
"properties": {
"error": {
"type": "string",
"description": "Detailed error message."
}
}
}
Aliases: create-allocation, createallocation