1. Packages
  2. Commercetools Provider
  3. API Docs
  4. AssociateRole
commercetools 1.19.3 published on Friday, Apr 4, 2025 by labd

commercetools.AssociateRole

Explore with Pulumi AI

Associate Roles provide a way to group granular Permissions and assign them to Associates within a Business Unit.

See also the Associate Role API Documentation

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.commercetools.Type;
import com.pulumi.commercetools.TypeArgs;
import com.pulumi.commercetools.inputs.TypeFieldArgs;
import com.pulumi.commercetools.inputs.TypeFieldTypeArgs;
import com.pulumi.commercetools.AssociateRole;
import com.pulumi.commercetools.AssociateRoleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var my_type = new Type("my-type", TypeArgs.builder()
            .key("my-type")
            .name(Map.ofEntries(
                Map.entry("en", "My type"),
                Map.entry("nl", "Mijn type")
            ))
            .resourceTypeIds("associate-role")
            .fields(TypeFieldArgs.builder()
                .name("my-field")
                .label(Map.ofEntries(
                    Map.entry("en", "My field"),
                    Map.entry("nl", "Mijn veld")
                ))
                .type(TypeFieldTypeArgs.builder()
                    .name("String")
                    .build())
                .build())
            .build());

        var my_role = new AssociateRole("my-role", AssociateRoleArgs.builder()
            .key("my-role")
            .buyerAssignable(false)
            .permissions(            
                "AddChildUnits",
                "UpdateAssociates",
                "UpdateBusinessUnitDetails",
                "UpdateParentUnit",
                "ViewMyCarts",
                "ViewOthersCarts",
                "UpdateMyCarts",
                "UpdateOthersCarts",
                "CreateMyCarts",
                "CreateOthersCarts",
                "DeleteMyCarts",
                "DeleteOthersCarts",
                "ViewMyOrders",
                "ViewOthersOrders",
                "UpdateMyOrders",
                "UpdateOthersOrders",
                "CreateMyOrdersFromMyCarts",
                "CreateMyOrdersFromMyQuotes",
                "CreateOrdersFromOthersCarts",
                "CreateOrdersFromOthersQuotes",
                "ViewMyQuotes",
                "ViewOthersQuotes",
                "AcceptMyQuotes",
                "AcceptOthersQuotes",
                "DeclineMyQuotes",
                "DeclineOthersQuotes",
                "RenegotiateMyQuotes",
                "RenegotiateOthersQuotes",
                "ReassignMyQuotes",
                "ReassignOthersQuotes",
                "ViewMyQuoteRequests",
                "ViewOthersQuoteRequests",
                "UpdateMyQuoteRequests",
                "UpdateOthersQuoteRequests",
                "CreateMyQuoteRequestsFromMyCarts",
                "CreateQuoteRequestsFromOthersCarts",
                "CreateApprovalRules",
                "UpdateApprovalRules",
                "UpdateApprovalFlows")
            .custom(AssociateRoleCustomArgs.builder()
                .typeId(my_type.typeId())
                .fields(Map.of("my-field", "My value"))
                .build())
            .build());

    }
}
Copy
resources:
  my-type:
    type: commercetools:Type
    properties:
      key: my-type
      name:
        en: My type
        nl: Mijn type
      resourceTypeIds:
        - associate-role
      fields:
        - name: my-field
          label:
            en: My field
            nl: Mijn veld
          type:
            name: String
  my-role:
    type: commercetools:AssociateRole
    properties:
      key: my-role
      buyerAssignable: false
      permissions:
        - AddChildUnits
        - UpdateAssociates
        - UpdateBusinessUnitDetails
        - UpdateParentUnit
        - ViewMyCarts
        - ViewOthersCarts
        - UpdateMyCarts
        - UpdateOthersCarts
        - CreateMyCarts
        - CreateOthersCarts
        - DeleteMyCarts
        - DeleteOthersCarts
        - ViewMyOrders
        - ViewOthersOrders
        - UpdateMyOrders
        - UpdateOthersOrders
        - CreateMyOrdersFromMyCarts
        - CreateMyOrdersFromMyQuotes
        - CreateOrdersFromOthersCarts
        - CreateOrdersFromOthersQuotes
        - ViewMyQuotes
        - ViewOthersQuotes
        - AcceptMyQuotes
        - AcceptOthersQuotes
        - DeclineMyQuotes
        - DeclineOthersQuotes
        - RenegotiateMyQuotes
        - RenegotiateOthersQuotes
        - ReassignMyQuotes
        - ReassignOthersQuotes
        - ViewMyQuoteRequests
        - ViewOthersQuoteRequests
        - UpdateMyQuoteRequests
        - UpdateOthersQuoteRequests
        - CreateMyQuoteRequestsFromMyCarts
        - CreateQuoteRequestsFromOthersCarts
        - CreateApprovalRules
        - UpdateApprovalRules
        - UpdateApprovalFlows
      custom:
        - typeId: ${["my-type"].typeId}
          fields:
            my-field: My value
Copy

Create AssociateRole Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AssociateRole(name: string, args: AssociateRoleArgs, opts?: CustomResourceOptions);
@overload
def AssociateRole(resource_name: str,
                  args: AssociateRoleArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def AssociateRole(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  key: Optional[str] = None,
                  permissions: Optional[Sequence[str]] = None,
                  buyer_assignable: Optional[bool] = None,
                  custom: Optional[AssociateRoleCustomArgs] = None,
                  name: Optional[str] = None)
func NewAssociateRole(ctx *Context, name string, args AssociateRoleArgs, opts ...ResourceOption) (*AssociateRole, error)
public AssociateRole(string name, AssociateRoleArgs args, CustomResourceOptions? opts = null)
public AssociateRole(String name, AssociateRoleArgs args)
public AssociateRole(String name, AssociateRoleArgs args, CustomResourceOptions options)
type: commercetools:AssociateRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AssociateRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AssociateRoleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AssociateRoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AssociateRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AssociateRoleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var associateRoleResource = new Commercetools.AssociateRole("associateRoleResource", new()
{
    Key = "string",
    Permissions = new[]
    {
        "string",
    },
    BuyerAssignable = false,
    Custom = new Commercetools.Inputs.AssociateRoleCustomArgs
    {
        Fields = 
        {
            { "string", "string" },
        },
        TypeId = "string",
    },
    Name = "string",
});
Copy
example, err := commercetools.NewAssociateRole(ctx, "associateRoleResource", &commercetools.AssociateRoleArgs{
Key: pulumi.String("string"),
Permissions: pulumi.StringArray{
pulumi.String("string"),
},
BuyerAssignable: pulumi.Bool(false),
Custom: &.AssociateRoleCustomArgs{
Fields: pulumi.StringMap{
"string": pulumi.String("string"),
},
TypeId: pulumi.String("string"),
},
Name: pulumi.String("string"),
})
Copy
var associateRoleResource = new AssociateRole("associateRoleResource", AssociateRoleArgs.builder()
    .key("string")
    .permissions("string")
    .buyerAssignable(false)
    .custom(AssociateRoleCustomArgs.builder()
        .fields(Map.of("string", "string"))
        .typeId("string")
        .build())
    .name("string")
    .build());
Copy
associate_role_resource = commercetools.AssociateRole("associateRoleResource",
    key="string",
    permissions=["string"],
    buyer_assignable=False,
    custom={
        "fields": {
            "string": "string",
        },
        "type_id": "string",
    },
    name="string")
Copy
const associateRoleResource = new commercetools.AssociateRole("associateRoleResource", {
    key: "string",
    permissions: ["string"],
    buyerAssignable: false,
    custom: {
        fields: {
            string: "string",
        },
        typeId: "string",
    },
    name: "string",
});
Copy
type: commercetools:AssociateRole
properties:
    buyerAssignable: false
    custom:
        fields:
            string: string
        typeId: string
    key: string
    name: string
    permissions:
        - string
Copy

AssociateRole Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AssociateRole resource accepts the following input properties:

Key This property is required. string
User-defined unique identifier of the associate role.
Permissions This property is required. List<string>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
BuyerAssignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
Custom AssociateRoleCustom
Custom fields for this resource.
Name string
Name of the associate role.
Key This property is required. string
User-defined unique identifier of the associate role.
Permissions This property is required. []string
List of permissions for the associate role. See the Associate Role API Documentation for more information.
BuyerAssignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
Custom AssociateRoleCustomArgs
Custom fields for this resource.
Name string
Name of the associate role.
key This property is required. String
User-defined unique identifier of the associate role.
permissions This property is required. List<String>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
buyerAssignable Boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustom
Custom fields for this resource.
name String
Name of the associate role.
key This property is required. string
User-defined unique identifier of the associate role.
permissions This property is required. string[]
List of permissions for the associate role. See the Associate Role API Documentation for more information.
buyerAssignable boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustom
Custom fields for this resource.
name string
Name of the associate role.
key This property is required. str
User-defined unique identifier of the associate role.
permissions This property is required. Sequence[str]
List of permissions for the associate role. See the Associate Role API Documentation for more information.
buyer_assignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustomArgs
Custom fields for this resource.
name str
Name of the associate role.
key This property is required. String
User-defined unique identifier of the associate role.
permissions This property is required. List<String>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
buyerAssignable Boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom Property Map
Custom fields for this resource.
name String
Name of the associate role.

Outputs

All input properties are implicitly available as output properties. Additionally, the AssociateRole resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Version double
Current version of the associate role.
Id string
The provider-assigned unique ID for this managed resource.
Version float64
Current version of the associate role.
id String
The provider-assigned unique ID for this managed resource.
version Double
Current version of the associate role.
id string
The provider-assigned unique ID for this managed resource.
version number
Current version of the associate role.
id str
The provider-assigned unique ID for this managed resource.
version float
Current version of the associate role.
id String
The provider-assigned unique ID for this managed resource.
version Number
Current version of the associate role.

Look up Existing AssociateRole Resource

Get an existing AssociateRole resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AssociateRoleState, opts?: CustomResourceOptions): AssociateRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        buyer_assignable: Optional[bool] = None,
        custom: Optional[AssociateRoleCustomArgs] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        permissions: Optional[Sequence[str]] = None,
        version: Optional[float] = None) -> AssociateRole
func GetAssociateRole(ctx *Context, name string, id IDInput, state *AssociateRoleState, opts ...ResourceOption) (*AssociateRole, error)
public static AssociateRole Get(string name, Input<string> id, AssociateRoleState? state, CustomResourceOptions? opts = null)
public static AssociateRole get(String name, Output<String> id, AssociateRoleState state, CustomResourceOptions options)
resources:  _:    type: commercetools:AssociateRole    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BuyerAssignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
Custom AssociateRoleCustom
Custom fields for this resource.
Key string
User-defined unique identifier of the associate role.
Name string
Name of the associate role.
Permissions List<string>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
Version double
Current version of the associate role.
BuyerAssignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
Custom AssociateRoleCustomArgs
Custom fields for this resource.
Key string
User-defined unique identifier of the associate role.
Name string
Name of the associate role.
Permissions []string
List of permissions for the associate role. See the Associate Role API Documentation for more information.
Version float64
Current version of the associate role.
buyerAssignable Boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustom
Custom fields for this resource.
key String
User-defined unique identifier of the associate role.
name String
Name of the associate role.
permissions List<String>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
version Double
Current version of the associate role.
buyerAssignable boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustom
Custom fields for this resource.
key string
User-defined unique identifier of the associate role.
name string
Name of the associate role.
permissions string[]
List of permissions for the associate role. See the Associate Role API Documentation for more information.
version number
Current version of the associate role.
buyer_assignable bool
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom AssociateRoleCustomArgs
Custom fields for this resource.
key str
User-defined unique identifier of the associate role.
name str
Name of the associate role.
permissions Sequence[str]
List of permissions for the associate role. See the Associate Role API Documentation for more information.
version float
Current version of the associate role.
buyerAssignable Boolean
Whether the associate role can be assigned to an associate by a buyer. If false, the associate role can only be assigned using the general endpoint. Defaults to true.
custom Property Map
Custom fields for this resource.
key String
User-defined unique identifier of the associate role.
name String
Name of the associate role.
permissions List<String>
List of permissions for the associate role. See the Associate Role API Documentation for more information.
version Number
Current version of the associate role.

Supporting Types

AssociateRoleCustom
, AssociateRoleCustomArgs

Fields Dictionary<string, string>
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
TypeId string
The ID of the custom type to use for this resource.
Fields map[string]string
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
TypeId string
The ID of the custom type to use for this resource.
fields Map<String,String>
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId String
The ID of the custom type to use for this resource.
fields {[key: string]: string}
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId string
The ID of the custom type to use for this resource.
fields Mapping[str, str]
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
type_id str
The ID of the custom type to use for this resource.
fields Map<String>
CustomValue fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId String
The ID of the custom type to use for this resource.

Package Details

Repository
commercetools labd/terraform-provider-commercetools
License
Notes
This Pulumi package is based on the commercetools Terraform Provider.