github.com/anthropics/anthropic-sdk-go@v1.70.1/betaorganizationworkspace.go (about)

     1  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
     2  
     3  package anthropic
     4  
     5  import (
     6  	"context"
     7  	"encoding/json"
     8  	"errors"
     9  	"fmt"
    10  	"net/http"
    11  	"net/url"
    12  	"slices"
    13  	"time"
    14  
    15  	"github.com/anthropics/anthropic-sdk-go/internal/apijson"
    16  	"github.com/anthropics/anthropic-sdk-go/internal/apiquery"
    17  	"github.com/anthropics/anthropic-sdk-go/internal/requestconfig"
    18  	"github.com/anthropics/anthropic-sdk-go/option"
    19  	"github.com/anthropics/anthropic-sdk-go/packages/pagination"
    20  	"github.com/anthropics/anthropic-sdk-go/packages/param"
    21  	"github.com/anthropics/anthropic-sdk-go/packages/respjson"
    22  	"github.com/anthropics/anthropic-sdk-go/shared/constant"
    23  )
    24  
    25  // BetaOrganizationWorkspaceService contains methods and other services that help
    26  // with interacting with the anthropic API.
    27  //
    28  // Note, unlike clients, this service does not read variables from the environment
    29  // automatically. You should not instantiate this service directly, and instead use
    30  // the [NewBetaOrganizationWorkspaceService] method instead.
    31  type BetaOrganizationWorkspaceService struct {
    32  	Options         []option.RequestOption
    33  	RateLimits      BetaOrganizationWorkspaceRateLimitService
    34  	Members         BetaOrganizationWorkspaceMemberService
    35  	ServiceAccounts BetaOrganizationWorkspaceServiceAccountService
    36  }
    37  
    38  // NewBetaOrganizationWorkspaceService generates a new service that applies the
    39  // given options to each request. These options are applied after the parent
    40  // client's options (if there is one), and before any request-specific options.
    41  func NewBetaOrganizationWorkspaceService(opts ...option.RequestOption) (r BetaOrganizationWorkspaceService) {
    42  	r = BetaOrganizationWorkspaceService{}
    43  	r.Options = opts
    44  	r.RateLimits = NewBetaOrganizationWorkspaceRateLimitService(opts...)
    45  	r.Members = NewBetaOrganizationWorkspaceMemberService(opts...)
    46  	r.ServiceAccounts = NewBetaOrganizationWorkspaceServiceAccountService(opts...)
    47  	return
    48  }
    49  
    50  // Create Workspace
    51  func (r *BetaOrganizationWorkspaceService) New(ctx context.Context, params BetaOrganizationWorkspaceNewParams, opts ...option.RequestOption) (res *BetaWorkspace, err error) {
    52  	for _, v := range params.Betas {
    53  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
    54  	}
    55  	opts = slices.Concat(r.Options, opts)
    56  	path := "v1/organizations/workspaces?beta=true"
    57  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
    58  	return res, err
    59  }
    60  
    61  // Get Workspace
    62  func (r *BetaOrganizationWorkspaceService) Get(ctx context.Context, workspaceID string, opts ...option.RequestOption) (res *BetaWorkspace, err error) {
    63  	opts = slices.Concat(r.Options, opts)
    64  	if workspaceID == "" {
    65  		err = errors.New("missing required workspace_id parameter")
    66  		return nil, err
    67  	}
    68  	path := fmt.Sprintf("v1/organizations/workspaces/%s?beta=true", workspaceID)
    69  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
    70  	return res, err
    71  }
    72  
    73  // Update Workspace
    74  func (r *BetaOrganizationWorkspaceService) Update(ctx context.Context, workspaceID string, body BetaOrganizationWorkspaceUpdateParams, opts ...option.RequestOption) (res *BetaWorkspace, err error) {
    75  	opts = slices.Concat(r.Options, opts)
    76  	if workspaceID == "" {
    77  		err = errors.New("missing required workspace_id parameter")
    78  		return nil, err
    79  	}
    80  	path := fmt.Sprintf("v1/organizations/workspaces/%s?beta=true", workspaceID)
    81  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
    82  	return res, err
    83  }
    84  
    85  // List Workspaces
    86  func (r *BetaOrganizationWorkspaceService) List(ctx context.Context, query BetaOrganizationWorkspaceListParams, opts ...option.RequestOption) (res *pagination.Page[BetaWorkspace], err error) {
    87  	var raw *http.Response
    88  	opts = slices.Concat(r.Options, opts)
    89  	opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
    90  	path := "v1/organizations/workspaces?beta=true"
    91  	cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	err = cfg.Execute()
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	res.SetPageConfig(cfg, raw)
   100  	return res, nil
   101  }
   102  
   103  // List Workspaces
   104  func (r *BetaOrganizationWorkspaceService) ListAutoPaging(ctx context.Context, query BetaOrganizationWorkspaceListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BetaWorkspace] {
   105  	return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
   106  }
   107  
   108  // Archive Workspace
   109  func (r *BetaOrganizationWorkspaceService) Archive(ctx context.Context, workspaceID string, opts ...option.RequestOption) (res *BetaWorkspace, err error) {
   110  	opts = slices.Concat(r.Options, opts)
   111  	if workspaceID == "" {
   112  		err = errors.New("missing required workspace_id parameter")
   113  		return nil, err
   114  	}
   115  	path := fmt.Sprintf("v1/organizations/workspaces/%s/archive?beta=true", workspaceID)
   116  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
   117  	return res, err
   118  }
   119  
   120  type BetaAllowedInferenceGeo string
   121  
   122  const (
   123  	BetaAllowedInferenceGeoGlobal BetaAllowedInferenceGeo = "global"
   124  	BetaAllowedInferenceGeoUs     BetaAllowedInferenceGeo = "us"
   125  )
   126  
   127  type BetaDataResidency struct {
   128  	// Permitted inference geo values. 'unrestricted' means all geos are allowed.
   129  	AllowedInferenceGeos BetaDataResidencyAllowedInferenceGeosUnion `json:"allowed_inference_geos" api:"required"`
   130  	// Default inference geo applied when requests omit the parameter.
   131  	DefaultInferenceGeo string `json:"default_inference_geo" api:"required"`
   132  	// Geographic region for workspace data storage. Immutable after creation.
   133  	WorkspaceGeo string `json:"workspace_geo" api:"required"`
   134  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   135  	JSON struct {
   136  		AllowedInferenceGeos respjson.Field
   137  		DefaultInferenceGeo  respjson.Field
   138  		WorkspaceGeo         respjson.Field
   139  		ExtraFields          map[string]respjson.Field
   140  		raw                  string
   141  	} `json:"-"`
   142  }
   143  
   144  // Returns the unmodified JSON received from the API
   145  func (r BetaDataResidency) RawJSON() string { return r.JSON.raw }
   146  func (r *BetaDataResidency) UnmarshalJSON(data []byte) error {
   147  	return apijson.UnmarshalRoot(data, r)
   148  }
   149  
   150  // BetaDataResidencyAllowedInferenceGeosUnion contains all possible properties and
   151  // values from [[]string], [constant.Unrestricted].
   152  //
   153  // Use the methods beginning with 'As' to cast the union to one of its variants.
   154  //
   155  // If the underlying value is not a json object, one of the following properties
   156  // will be valid: OfGeos OfUnrestricted]
   157  type BetaDataResidencyAllowedInferenceGeosUnion struct {
   158  	// This field will be present if the value is a [[]string] instead of an object.
   159  	OfGeos []string `json:",inline"`
   160  	// This field will be present if the value is a [constant.Unrestricted] instead of
   161  	// an object.
   162  	OfUnrestricted constant.Unrestricted `json:",inline"`
   163  	JSON           struct {
   164  		OfGeos         respjson.Field
   165  		OfUnrestricted respjson.Field
   166  		raw            string
   167  	} `json:"-"`
   168  }
   169  
   170  func (u BetaDataResidencyAllowedInferenceGeosUnion) AsGeos() (v []string) {
   171  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   172  	return
   173  }
   174  
   175  func (u BetaDataResidencyAllowedInferenceGeosUnion) AsUnrestricted() (v constant.Unrestricted) {
   176  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   177  	return
   178  }
   179  
   180  // Returns the unmodified JSON received from the API
   181  func (u BetaDataResidencyAllowedInferenceGeosUnion) RawJSON() string { return u.JSON.raw }
   182  
   183  func (r *BetaDataResidencyAllowedInferenceGeosUnion) UnmarshalJSON(data []byte) error {
   184  	return apijson.UnmarshalRoot(data, r)
   185  }
   186  
   187  type BetaDataResidencyCreateConfigParam struct {
   188  	// Permitted inference geo values. Defaults to 'unrestricted' if omitted, which
   189  	// allows all geos. Use the string 'unrestricted' to allow all geos, or a list of
   190  	// specific geos.
   191  	AllowedInferenceGeos BetaDataResidencyCreateConfigAllowedInferenceGeosUnionParam `json:"allowed_inference_geos,omitzero"`
   192  	// Default inference geo applied when requests omit the parameter. Defaults to
   193  	// 'global' if omitted. Must be a member of `allowed_inference_geos` unless
   194  	// `allowed_inference_geos` is `"unrestricted"`.
   195  	//
   196  	// Any of "global", "us".
   197  	DefaultInferenceGeo BetaDataResidencyCreateConfigDefaultInferenceGeo `json:"default_inference_geo,omitzero"`
   198  	// Geographic region for workspace data storage. Immutable after creation. Defaults
   199  	// to 'us' if omitted.
   200  	//
   201  	// Any of "us".
   202  	WorkspaceGeo BetaDataResidencyCreateConfigWorkspaceGeo `json:"workspace_geo,omitzero"`
   203  	paramObj
   204  }
   205  
   206  func (r BetaDataResidencyCreateConfigParam) MarshalJSON() (data []byte, err error) {
   207  	type shadow BetaDataResidencyCreateConfigParam
   208  	return param.MarshalObject(r, (*shadow)(&r))
   209  }
   210  func (r *BetaDataResidencyCreateConfigParam) UnmarshalJSON(data []byte) error {
   211  	return apijson.UnmarshalRoot(data, r)
   212  }
   213  
   214  // Only one field can be non-zero.
   215  //
   216  // Use [param.IsOmitted] to confirm if a field is set.
   217  type BetaDataResidencyCreateConfigAllowedInferenceGeosUnionParam struct {
   218  	OfGeos []BetaAllowedInferenceGeo `json:",omitzero,inline"`
   219  	// Construct this variant with constant.ValueOf[constant.Unrestricted]()
   220  	OfUnrestricted constant.Unrestricted `json:",omitzero,inline"`
   221  	paramUnion
   222  }
   223  
   224  func (u BetaDataResidencyCreateConfigAllowedInferenceGeosUnionParam) MarshalJSON() ([]byte, error) {
   225  	return param.MarshalUnion(u, u.OfGeos, u.OfUnrestricted)
   226  }
   227  func (u *BetaDataResidencyCreateConfigAllowedInferenceGeosUnionParam) UnmarshalJSON(data []byte) error {
   228  	return apijson.UnmarshalRoot(data, u)
   229  }
   230  
   231  func (u *BetaDataResidencyCreateConfigAllowedInferenceGeosUnionParam) asAny() any {
   232  	if !param.IsOmitted(u.OfGeos) {
   233  		return &u.OfGeos
   234  	} else if !param.IsOmitted(u.OfUnrestricted) {
   235  		return &u.OfUnrestricted
   236  	}
   237  	return nil
   238  }
   239  
   240  // Default inference geo applied when requests omit the parameter. Defaults to
   241  // 'global' if omitted. Must be a member of `allowed_inference_geos` unless
   242  // `allowed_inference_geos` is `"unrestricted"`.
   243  type BetaDataResidencyCreateConfigDefaultInferenceGeo string
   244  
   245  const (
   246  	BetaDataResidencyCreateConfigDefaultInferenceGeoGlobal BetaDataResidencyCreateConfigDefaultInferenceGeo = "global"
   247  	BetaDataResidencyCreateConfigDefaultInferenceGeoUs     BetaDataResidencyCreateConfigDefaultInferenceGeo = "us"
   248  )
   249  
   250  // Geographic region for workspace data storage. Immutable after creation. Defaults
   251  // to 'us' if omitted.
   252  type BetaDataResidencyCreateConfigWorkspaceGeo string
   253  
   254  const (
   255  	BetaDataResidencyCreateConfigWorkspaceGeoUs BetaDataResidencyCreateConfigWorkspaceGeo = "us"
   256  )
   257  
   258  type BetaDataResidencyUpdateConfigParam struct {
   259  	// Permitted inference geo values. Use 'unrestricted' to allow all geos, or a list
   260  	// of specific geos.
   261  	AllowedInferenceGeos BetaDataResidencyUpdateConfigAllowedInferenceGeosUnionParam `json:"allowed_inference_geos,omitzero"`
   262  	// Default inference geo applied when requests omit the parameter. Must be a member
   263  	// of `allowed_inference_geos` unless `allowed_inference_geos` is `"unrestricted"`.
   264  	//
   265  	// Any of "global", "us".
   266  	DefaultInferenceGeo BetaDataResidencyUpdateConfigDefaultInferenceGeo `json:"default_inference_geo,omitzero"`
   267  	paramObj
   268  }
   269  
   270  func (r BetaDataResidencyUpdateConfigParam) MarshalJSON() (data []byte, err error) {
   271  	type shadow BetaDataResidencyUpdateConfigParam
   272  	return param.MarshalObject(r, (*shadow)(&r))
   273  }
   274  func (r *BetaDataResidencyUpdateConfigParam) UnmarshalJSON(data []byte) error {
   275  	return apijson.UnmarshalRoot(data, r)
   276  }
   277  
   278  // Only one field can be non-zero.
   279  //
   280  // Use [param.IsOmitted] to confirm if a field is set.
   281  type BetaDataResidencyUpdateConfigAllowedInferenceGeosUnionParam struct {
   282  	OfGeos []BetaAllowedInferenceGeo `json:",omitzero,inline"`
   283  	// Construct this variant with constant.ValueOf[constant.Unrestricted]()
   284  	OfUnrestricted constant.Unrestricted `json:",omitzero,inline"`
   285  	paramUnion
   286  }
   287  
   288  func (u BetaDataResidencyUpdateConfigAllowedInferenceGeosUnionParam) MarshalJSON() ([]byte, error) {
   289  	return param.MarshalUnion(u, u.OfGeos, u.OfUnrestricted)
   290  }
   291  func (u *BetaDataResidencyUpdateConfigAllowedInferenceGeosUnionParam) UnmarshalJSON(data []byte) error {
   292  	return apijson.UnmarshalRoot(data, u)
   293  }
   294  
   295  func (u *BetaDataResidencyUpdateConfigAllowedInferenceGeosUnionParam) asAny() any {
   296  	if !param.IsOmitted(u.OfGeos) {
   297  		return &u.OfGeos
   298  	} else if !param.IsOmitted(u.OfUnrestricted) {
   299  		return &u.OfUnrestricted
   300  	}
   301  	return nil
   302  }
   303  
   304  // Default inference geo applied when requests omit the parameter. Must be a member
   305  // of `allowed_inference_geos` unless `allowed_inference_geos` is `"unrestricted"`.
   306  type BetaDataResidencyUpdateConfigDefaultInferenceGeo string
   307  
   308  const (
   309  	BetaDataResidencyUpdateConfigDefaultInferenceGeoGlobal BetaDataResidencyUpdateConfigDefaultInferenceGeo = "global"
   310  	BetaDataResidencyUpdateConfigDefaultInferenceGeoUs     BetaDataResidencyUpdateConfigDefaultInferenceGeo = "us"
   311  )
   312  
   313  type BetaNoBillingWorkspaceRole string
   314  
   315  const (
   316  	BetaNoBillingWorkspaceRoleWorkspaceAdmin               BetaNoBillingWorkspaceRole = "workspace_admin"
   317  	BetaNoBillingWorkspaceRoleWorkspaceDeveloper           BetaNoBillingWorkspaceRole = "workspace_developer"
   318  	BetaNoBillingWorkspaceRoleWorkspaceRestrictedDeveloper BetaNoBillingWorkspaceRole = "workspace_restricted_developer"
   319  	BetaNoBillingWorkspaceRoleWorkspaceUser                BetaNoBillingWorkspaceRole = "workspace_user"
   320  )
   321  
   322  type BetaWorkspace struct {
   323  	// ID of the Workspace.
   324  	ID string `json:"id" api:"required"`
   325  	// RFC 3339 datetime string indicating when the Workspace was archived, or `null`
   326  	// if the Workspace is not archived.
   327  	ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
   328  	// Identifier for this Workspace's encryption compartment. When you configure a
   329  	// customer-managed encryption key (CMEK) on AWS, reference this value in your KMS
   330  	// key-policy condition so the key is scoped to this compartment. On GCP and Azure,
   331  	// Anthropic enforces the compartment binding automatically; you do not need to
   332  	// reference this value in your key configuration. See the CMEK integration guide
   333  	// for the required key configuration; unless your organization is on Claude
   334  	// Platform on AWS, it includes a separate value used during key validation. On
   335  	// Claude Platform on AWS there is no separate validation value: the key is
   336  	// validated against this Workspace's own value when it is attached, so if your key
   337  	// policy uses the compartment condition, add this value to it before attaching the
   338  	// key.
   339  	CompartmentID string `json:"compartment_id" api:"required"`
   340  	// RFC 3339 datetime string indicating when the Workspace was created.
   341  	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
   342  	// Data residency configuration.
   343  	DataResidency BetaDataResidency `json:"data_residency" api:"required"`
   344  	// Hex color code representing the Workspace in the Anthropic Console.
   345  	DisplayColor string `json:"display_color" api:"required"`
   346  	// ID of the customer-managed encryption key (CMEK) configuration to use for this
   347  	// Workspace. Setting this field requires CMEK to be enabled for your organization.
   348  	// When set, data stored for this Workspace is encrypted with the referenced key.
   349  	// Create key configurations with the External Keys API. On Claude Platform on AWS
   350  	// the value is the AWS KMS key ARN, and the key must be a single-Region key in the
   351  	// same AWS account and Region as the Workspace. On that platform the key is
   352  	// validated against this Workspace when it is attached, so a key-policy problem is
   353  	// reported as an error on this request. This field is write-once: once a key is
   354  	// attached to a Workspace it cannot be detached or replaced. To rotate key
   355  	// material, rotate the underlying key on your cloud KMS; the `external_key_id`
   356  	// stays the same.
   357  	ExternalKeyID string `json:"external_key_id" api:"required"`
   358  	// Name of the Workspace.
   359  	Name string `json:"name" api:"required"`
   360  	// User-defined tags as string key-value pairs. Keys may not begin with
   361  	// `anthropic`.
   362  	Tags map[string]string `json:"tags" api:"required"`
   363  	// Object type.
   364  	//
   365  	// For Workspaces, this is always `"workspace"`.
   366  	Type constant.Workspace `json:"type" default:"workspace"`
   367  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   368  	JSON struct {
   369  		ID            respjson.Field
   370  		ArchivedAt    respjson.Field
   371  		CompartmentID respjson.Field
   372  		CreatedAt     respjson.Field
   373  		DataResidency respjson.Field
   374  		DisplayColor  respjson.Field
   375  		ExternalKeyID respjson.Field
   376  		Name          respjson.Field
   377  		Tags          respjson.Field
   378  		Type          respjson.Field
   379  		ExtraFields   map[string]respjson.Field
   380  		raw           string
   381  	} `json:"-"`
   382  }
   383  
   384  // Returns the unmodified JSON received from the API
   385  func (r BetaWorkspace) RawJSON() string { return r.JSON.raw }
   386  func (r *BetaWorkspace) UnmarshalJSON(data []byte) error {
   387  	return apijson.UnmarshalRoot(data, r)
   388  }
   389  
   390  type BetaWorkspaceMember struct {
   391  	// Object type.
   392  	//
   393  	// For Workspace Members, this is always `"workspace_member"`.
   394  	Type constant.WorkspaceMember `json:"type" default:"workspace_member"`
   395  	// ID of the User.
   396  	UserID string `json:"user_id" api:"required"`
   397  	// ID of the Workspace.
   398  	WorkspaceID string `json:"workspace_id" api:"required"`
   399  	// Role of the Workspace Member.
   400  	//
   401  	// Any of "workspace_admin", "workspace_billing", "workspace_developer",
   402  	// "workspace_restricted_developer", "workspace_user".
   403  	WorkspaceRole BetaWorkspaceRole `json:"workspace_role" api:"required"`
   404  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   405  	JSON struct {
   406  		Type          respjson.Field
   407  		UserID        respjson.Field
   408  		WorkspaceID   respjson.Field
   409  		WorkspaceRole respjson.Field
   410  		ExtraFields   map[string]respjson.Field
   411  		raw           string
   412  	} `json:"-"`
   413  }
   414  
   415  // Returns the unmodified JSON received from the API
   416  func (r BetaWorkspaceMember) RawJSON() string { return r.JSON.raw }
   417  func (r *BetaWorkspaceMember) UnmarshalJSON(data []byte) error {
   418  	return apijson.UnmarshalRoot(data, r)
   419  }
   420  
   421  type BetaWorkspaceRole string
   422  
   423  const (
   424  	BetaWorkspaceRoleWorkspaceAdmin               BetaWorkspaceRole = "workspace_admin"
   425  	BetaWorkspaceRoleWorkspaceBilling             BetaWorkspaceRole = "workspace_billing"
   426  	BetaWorkspaceRoleWorkspaceDeveloper           BetaWorkspaceRole = "workspace_developer"
   427  	BetaWorkspaceRoleWorkspaceRestrictedDeveloper BetaWorkspaceRole = "workspace_restricted_developer"
   428  	BetaWorkspaceRoleWorkspaceUser                BetaWorkspaceRole = "workspace_user"
   429  )
   430  
   431  type BetaOrganizationWorkspaceNewParams struct {
   432  	// Name of the Workspace.
   433  	Name string `json:"name" api:"required"`
   434  	// Hex color code representing the Workspace in the Anthropic Console.
   435  	DisplayColor param.Opt[string] `json:"display_color,omitzero"`
   436  	// ID of the customer-managed encryption key (CMEK) configuration to use for this
   437  	// Workspace. Setting this field requires CMEK to be enabled for your organization.
   438  	// When set, data stored for this Workspace is encrypted with the referenced key.
   439  	// Create key configurations with the External Keys API. On Claude Platform on AWS
   440  	// the value is the AWS KMS key ARN, and the key must be a single-Region key in the
   441  	// same AWS account and Region as the Workspace. On that platform the key is
   442  	// validated against this Workspace when it is attached, so a key-policy problem is
   443  	// reported as an error on this request. This field is write-once: once a key is
   444  	// attached to a Workspace it cannot be detached or replaced. To rotate key
   445  	// material, rotate the underlying key on your cloud KMS; the `external_key_id`
   446  	// stays the same.
   447  	ExternalKeyID param.Opt[string] `json:"external_key_id,omitzero"`
   448  	// User-defined tags as string key-value pairs. Keys may not begin with
   449  	// `anthropic`.
   450  	Tags map[string]string `json:"tags,omitzero"`
   451  	// Data residency configuration for the workspace. If omitted, defaults to
   452  	// `workspace_geo: "us"`, `allowed_inference_geos: "unrestricted"`, and
   453  	// `default_inference_geo: "global"`.
   454  	DataResidency BetaDataResidencyCreateConfigParam `json:"data_residency,omitzero"`
   455  	// Optional header to specify the beta version(s) you want to use.
   456  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
   457  	paramObj
   458  }
   459  
   460  func (r BetaOrganizationWorkspaceNewParams) MarshalJSON() (data []byte, err error) {
   461  	type shadow BetaOrganizationWorkspaceNewParams
   462  	return param.MarshalObject(r, (*shadow)(&r))
   463  }
   464  func (r *BetaOrganizationWorkspaceNewParams) UnmarshalJSON(data []byte) error {
   465  	return apijson.UnmarshalRoot(data, r)
   466  }
   467  
   468  type BetaOrganizationWorkspaceUpdateParams struct {
   469  	// Hex color code representing the Workspace in the Anthropic Console.
   470  	DisplayColor param.Opt[string] `json:"display_color,omitzero"`
   471  	// ID of the customer-managed encryption key (CMEK) configuration to use for this
   472  	// Workspace. Setting this field requires CMEK to be enabled for your organization.
   473  	// When set, data stored for this Workspace is encrypted with the referenced key.
   474  	// Create key configurations with the External Keys API. On Claude Platform on AWS
   475  	// the value is the AWS KMS key ARN, and the key must be a single-Region key in the
   476  	// same AWS account and Region as the Workspace. On that platform the key is
   477  	// validated against this Workspace when it is attached, so a key-policy problem is
   478  	// reported as an error on this request. This field is write-once: once a key is
   479  	// attached to a Workspace it cannot be detached or replaced. To rotate key
   480  	// material, rotate the underlying key on your cloud KMS; the `external_key_id`
   481  	// stays the same.
   482  	ExternalKeyID param.Opt[string] `json:"external_key_id,omitzero"`
   483  	// Name of the Workspace.
   484  	Name param.Opt[string] `json:"name,omitzero"`
   485  	// User-defined tags as string key-value pairs. Keys may not begin with
   486  	// `anthropic`.
   487  	Tags map[string]string `json:"tags,omitzero"`
   488  	// Data residency configuration for the workspace.
   489  	DataResidency BetaDataResidencyUpdateConfigParam `json:"data_residency,omitzero"`
   490  	paramObj
   491  }
   492  
   493  func (r BetaOrganizationWorkspaceUpdateParams) MarshalJSON() (data []byte, err error) {
   494  	type shadow BetaOrganizationWorkspaceUpdateParams
   495  	return param.MarshalObject(r, (*shadow)(&r))
   496  }
   497  func (r *BetaOrganizationWorkspaceUpdateParams) UnmarshalJSON(data []byte) error {
   498  	return apijson.UnmarshalRoot(data, r)
   499  }
   500  
   501  type BetaOrganizationWorkspaceListParams struct {
   502  	// ID of the object to use as a cursor for pagination. When provided, returns the
   503  	// page of results immediately after this object.
   504  	AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
   505  	// ID of the object to use as a cursor for pagination. When provided, returns the
   506  	// page of results immediately before this object.
   507  	BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
   508  	// Whether to include Workspaces that have been archived in the response
   509  	IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
   510  	// Number of items to return per page.
   511  	//
   512  	// Defaults to `20`. Ranges from `1` to `1000`.
   513  	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
   514  	paramObj
   515  }
   516  
   517  // URLQuery serializes [BetaOrganizationWorkspaceListParams]'s query parameters as
   518  // `url.Values`.
   519  func (r BetaOrganizationWorkspaceListParams) URLQuery() (v url.Values, err error) {
   520  	return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
   521  		ArrayFormat:  apiquery.ArrayQueryFormatBrackets,
   522  		NestedFormat: apiquery.NestedQueryFormatBrackets,
   523  	})
   524  }