Class: Infrawrench::OwnershipNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.ownership

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ OwnershipNamespace

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

Parameters:



10055
10056
10057
# File 'lib/infrawrench/client.rb', line 10055

def initialize(transport)
  @transport = transport
end

Instance Method Details

#delete(resource_id:, org_id: nil, request_options: nil) ⇒ nil

Clear a resource's ownership

Removes the ownership record. The resource itself is untouched.

Requires permission: resources:write.

DELETE /api/org/orgId/ownership

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • resource_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • resource_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (nil)

    This endpoint returns no content.

Raises:



10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
# File 'lib/infrawrench/client.rb', line 10077

def delete(resource_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/ownership",
    path_params: { "orgId" => org_id },
    query: { "resourceId" => resource_id },
    accept: :empty,
    request_options: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

List resource ownership records

Every ownership record in the organization — owner, purpose and authorizing ticket, per resource. Only resources somebody has recorded something about appear; an absent record means the resource is unowned.

Requires permission: resources:read.

GET /api/org/orgId/ownership

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as ResourceOwnershipListResponse — see sig/infrawrench/sdk.rbs.

Raises:



10104
10105
10106
10107
10108
10109
10110
10111
# File 'lib/infrawrench/client.rb', line 10104

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/ownership",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#members(org_id: nil, request_options: nil) ⇒ Hash

List people an owner can be set to

Org members, as a minimal id/name/email projection for the owner picker. Requires only resources:read, deliberately not team:read: recording who owns a resource must not be reserved for whoever can also read roles and membership.

Requires permission: resources:read.

GET /api/org/orgId/ownership/members

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as OwnerCandidateListResponse — see sig/infrawrench/sdk.rbs.

Raises:



10130
10131
10132
10133
10134
10135
10136
10137
# File 'lib/infrawrench/client.rb', line 10130

def members(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/ownership/members",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#resource(resource_id:, org_id: nil, request_options: nil) ⇒ Hash

Get one resource's ownership

The ownership record for a single resource, or null when none is recorded.

Requires permission: resources:read.

GET /api/org/orgId/ownership/resource

Raises on 400: Bad request

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • resource_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • resource_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as ResourceOwnershipEnvelope — see sig/infrawrench/sdk.rbs.

Raises:



10156
10157
10158
10159
10160
10161
10162
10163
10164
# File 'lib/infrawrench/client.rb', line 10156

def resource(resource_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/ownership/resource",
    path_params: { "orgId" => org_id },
    query: { "resourceId" => resource_id },
    request_options: request_options
  )
end

#update(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Set a resource's ownership

Upsert keyed by resourceId — ownership is a property of the resource, so there is no separate create and update. Omitted fields keep their value and null clears one. Clearing every field removes the record entirely and the response is null, which is the new truth rather than an empty record. An ownerUserId must be a member of this organization: ownership that looks routable but reaches nobody is worse than none.

Requires permission: resources:write.

PUT /api/org/orgId/ownership

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as ResourceOwnershipPatch.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (resource_ownership_patch, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as ResourceOwnership & Hash | nil — see sig/infrawrench/sdk.rbs.

Raises:



10190
10191
10192
10193
10194
10195
10196
10197
10198
# File 'lib/infrawrench/client.rb', line 10190

def update(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "PUT",
    path: "/api/org/{orgId}/ownership",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end