Class: Stigg::Resources::V1Beta::EntityTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1_beta/entity_types.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EntityTypes

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EntityTypes.

Parameters:



85
86
87
# File 'lib/stigg/resources/v1_beta/entity_types.rb', line 85

def initialize(client:)
  @client = client
end

Instance Method Details

#list(after: nil, before: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::EntityTypeListResponse>

Some parameter documentations has been truncated, see Models::V1Beta::EntityTypeListParams for more details.

Returns a cursor-paginated list of entity types defined in the environment. Entity types are vendor-defined categories of resource that can be governed (e.g. Org, Team, User).

Parameters:

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • limit (Integer)

    Query param: Maximum number of items to return

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/stigg/resources/v1_beta/entity_types.rb', line 31

def list(params = {})
  query_params = [:after, :before, :limit]
  parsed, options = Stigg::V1Beta::EntityTypeListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "api/v1-beta/entity-types",
    query: query,
    headers: parsed.except(*query_params).transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1Beta::EntityTypeListResponse,
    options: options
  )
end

#upsert(types:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityTypeUpsertResponse

Some parameter documentations has been truncated, see Models::V1Beta::EntityTypeUpsertParams for more details.

Batched create-or-update of entity types. Existing types matched by id are updated; new ids are created. Idempotent — re-submitting the same payload converges to the same state.

Parameters:

  • types (Array<Stigg::Models::V1Beta::EntityTypeUpsertParams::Type>)

    Body param: Entity types to upsert (1–100 per request)

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/stigg/resources/v1_beta/entity_types.rb', line 69

def upsert(params)
  parsed, options = Stigg::V1Beta::EntityTypeUpsertParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :put,
    path: "api/v1-beta/entity-types",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1Beta::EntityTypeUpsertResponse,
    options: options
  )
end