Class: Infrawrench::BackupsDrillsNamespace

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

Overview

client.backups.drills

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ BackupsDrillsNamespace

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

Parameters:



1878
1879
1880
# File 'lib/infrawrench/client.rb', line 1878

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Record a restore drill

A verified drill must carry the measured time: an RPO comes from the backup, and an RTO can only come from somebody with a stopwatch — that number is the entire point of the exercise. A blocked drill must not carry one, because it never started.

Takes resources:write, not a settings permission: recording a drill is reporting what you did, and the person who spent Saturday restoring a database is rarely the person who set the recovery objective.

POST /api/org/orgId/backups/drills

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.

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

    Request body, shaped as RestoreDrillCreate.

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

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

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

Returns:

  • (Hash)

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

Raises:



1903
1904
1905
1906
1907
1908
1909
1910
1911
# File 'lib/infrawrench/client.rb', line 1903

def create(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/backups/drills",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

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

Delete a recorded drill

For one recorded against the wrong resource or the wrong date. Audited — deleting evidence that a restore failed is exactly the edit a reviewer would want to know about.

DELETE /api/org/orgId/backups/drills/drillId

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.

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

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

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



1929
1930
1931
1932
1933
1934
1935
1936
1937
# File 'lib/infrawrench/client.rb', line 1929

def delete(drill_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/backups/drills/{drillId}",
    path_params: { "orgId" => org_id, "drillId" => drill_id },
    accept: :empty,
    request_options: request_options
  )
end

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

Where every protected resource stands on restore

Backup coverage answers 'is there a backup'. This answers 'does it restore, and how long does it take' — a different question, and the one routinely answered wrongly on the day.

A drill is a record that somebody tried, not an automated restore: restoring a customer's database unattended costs real money, can collide with production, and cannot be generically verified. What the product can do is make the exercise scheduled, recorded and visible when it lapses.

GET /api/org/orgId/backups/drills

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.

  • valid_days (Integer, nil) (defaults to: nil)

    How long a verified drill counts for. Defaults to 180 days.

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

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

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

Returns:

  • (Hash)

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

Raises:



1962
1963
1964
1965
1966
1967
1968
1969
1970
# File 'lib/infrawrench/client.rb', line 1962

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

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

List recorded restore drills

GET /api/org/orgId/backups/drills/log

Parameters:

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

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

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

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

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

Returns:

  • (Hash)

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

Raises:



1982
1983
1984
1985
1986
1987
1988
1989
1990
# File 'lib/infrawrench/client.rb', line 1982

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