Class: Stigg::Resources::V1Beta::Customers::Entities

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Entities

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 Entities.

Parameters:



195
196
197
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 195

def initialize(client:)
  @client = client
end

Instance Method Details

#archive(id, ids:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::EntityArchiveResponse

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

Archives entities in bulk for the given customer by id.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • ids (Array<String>)

    Body param: Entity identifiers to act on

  • 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:



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 112

def archive(id, params)
  parsed, options = Stigg::V1Beta::Customers::EntityArchiveParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1-beta/customers/%1$s/entities/archive", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1Beta::Customers::EntityArchiveResponse,
    options: options
  )
end

#list(id, after: nil, before: nil, include_archived: nil, limit: nil, type_ref_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::Customers::EntityListResponse>

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

Retrieves a paginated list of entities for the given customer.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • include_archived (Symbol, Stigg::Models::V1Beta::Customers::EntityListParams::IncludeArchived)

    Query param: Whether to include archived entities. One of: true, false

  • limit (Integer)

    Query param: Maximum number of items to return

  • type_ref_id (String)

    Query param: Filter results to entities of a specific entity type, by the type’s

  • 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:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 74

def list(id, params = {})
  query_params = [:after, :before, :include_archived, :limit, :type_ref_id]
  parsed, options = Stigg::V1Beta::Customers::EntityListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/entities", id],
    query: query.transform_keys(include_archived: "includeArchived", type_ref_id: "typeRefId"),
    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::Customers::EntityListResponse,
    options: options
  )
end

#retrieve(entity_id, id:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::EntityRetrieveResponse

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

Retrieves a single entity for the given customer by its identifier.

Parameters:

  • entity_id (String)

    Path param: The entity identifier (refId)

  • id (String)

    Path param: The customer identifier (owner) the entity belongs to

  • 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:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 28

def retrieve(entity_id, params)
  parsed, options = Stigg::V1Beta::Customers::EntityRetrieveParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/entities/%2$s", id, entity_id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1Beta::Customers::EntityRetrieveResponse,
    options: options
  )
end

#unarchive(id, ids:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::EntityUnarchiveResponse

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

Restores previously archived entities in bulk for the given customer by id.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • ids (Array<String>)

    Body param: Entity identifiers to act on

  • 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:



145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 145

def unarchive(id, params)
  parsed, options = Stigg::V1Beta::Customers::EntityUnarchiveParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1-beta/customers/%1$s/entities/unarchive", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1Beta::Customers::EntityUnarchiveResponse,
    options: options
  )
end

#upsert(id, entities:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::EntityUpsertResponse

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

Creates or updates entities in bulk for the given customer. Existing entities matched by id are updated; new ids are created.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • entities (Array<Stigg::Models::V1Beta::Customers::EntityUpsertParams::Entity>)

    Body param: List of entities to create or update (1-100 entries)

  • 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:



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/stigg/resources/v1_beta/customers/entities.rb', line 179

def upsert(id, params)
  parsed, options = Stigg::V1Beta::Customers::EntityUpsertParams.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/customers/%1$s/entities", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1Beta::Customers::EntityUpsertResponse,
    options: options
  )
end