# Class CSCertificateTaskContext

java.lang.Object
com.io7m.certusine.vanilla.internal.tasks.CSCertificateTaskContext

public final class CSCertificateTaskContext extends Object
The execution context for a task.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CSCertificateTaskContext(CSStrings inStrings, CSEventServiceType inEvents, CSTelemetryServiceType inTelemetry, CSOptions inOptions, CSCertificateStoreServiceType inCertificateStores, Clock inClock, org.shredzone.acme4j.Account inAccount, CSDomain inDomain, CSCertificate inCertificate, int inRetryAttemptsMax, CSDNSQueriesFactoryType inDnsQueries)`
  The execution context for a task.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CSCertificate`
  `certificate()`
  `CSCertificateStoreServiceType`
  `certificateStores()`
  `Clock`
  `clock()`
  `org.shredzone.acme4j.Order`
  `createOrGetOrder()`
  Create or get an order for this domain and certificate.
  `void`
  `destroyOrder()`
  Destroy the current order.
  `CSDNSQueriesFactoryType`
  `dnsQueries()`
  `void`
  `dnsRecordCreated(String name, String text)`
  A DNS record was created.
  `List<CSDNSTXTRecord>`
  `dnsRecordsCreated()`
  `CSDomain`
  `domain()`
  `CSEventServiceType`
  `events()`
  `CSCertificateTaskFailedPermanently`
  `failedPermanently(Exception exception)`
  Mark this context as permanently failed due to the given exception, and return a failed permanently status.
  `String`
  `formatProblem(org.shredzone.acme4j.Problem error)`
  Format a problem report as text.
  `boolean`
  `isFailed()`
  `OffsetDateTime`
  `now()`
  `CSOptions`
  `options()`
  `boolean`
  `retryAttemptsExhausted(int retryAttempts)`
  `int`
  `retryAttemptsMax()`
  `CSStrings`
  `strings()`
  `CSTelemetryServiceType`
  `telemetry()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CSCertificateTaskContext

    public CSCertificateTaskContext(CSStrings inStrings, CSEventServiceType inEvents, CSTelemetryServiceType inTelemetry, CSOptions inOptions, CSCertificateStoreServiceType inCertificateStores, Clock inClock, org.shredzone.acme4j.Account inAccount, CSDomain inDomain, CSCertificate inCertificate, int inRetryAttemptsMax, CSDNSQueriesFactoryType inDnsQueries)
    The execution context for a task.
    Parameters:
      `inStrings` - The string resources
      `inEvents` - The event service
      `inTelemetry` - The telemetry service
      `inOptions` - The options
      `inCertificateStores` - The certificate stores
      `inClock` - The clock
      `inAccount` - The account
      `inDomain` - The domain
      `inCertificate` - The certificate
      `inRetryAttemptsMax` - The maximum number of retry attempts
      `inDnsQueries` - The DNS query factory

- ## Method Details

  - ### telemetry

    public CSTelemetryServiceType telemetry()
    Returns:
      The telemetry service

  - ### certificateStores

    public CSCertificateStoreServiceType certificateStores()
    Returns:
      The certificate store used during execution

  - ### now

    public OffsetDateTime now()
    Returns:
      The current time

  - ### clock

    public Clock clock()
    Returns:
      The clock used for time operations

  - ### dnsQueries

    public CSDNSQueriesFactoryType dnsQueries()
    Returns:
      A factory of DNS queries

  - ### options

    public CSOptions options()
    Returns:
      The configuration options

  - ### strings

    public CSStrings strings()
    Returns:
      The string resources

  - ### domain

    public CSDomain domain()
    Returns:
      The current domain

  - ### certificate

    public CSCertificate certificate()
    Returns:
      The current certificate being processed

  - ### retryAttemptsMax

    public int retryAttemptsMax()
    Returns:
      The maximum number of times a task can be retried

  - ### dnsRecordCreated

    public void dnsRecordCreated(String name, String text)
    A DNS record was created.
    Parameters:
      `name` - The record name
      `text` - The record text

  - ### dnsRecordsCreated

    public List<CSDNSTXTRecord> dnsRecordsCreated()
    Returns:
      The list of DNS TXT records created during execution

  - ### retryAttemptsExhausted

    public boolean retryAttemptsExhausted(int retryAttempts)
    Parameters:
      `retryAttempts` - The number of times a task has been retried
    Returns:
      `true` if the given number of retry attempts exceeds the allowed number

  - ### formatProblem

    public String formatProblem(org.shredzone.acme4j.Problem error)
    Format a problem report as text.
    Parameters:
      `error` - The report
    Returns:
      The formatted report

  - ### events

    public CSEventServiceType events()
    Returns:
      The event service

  - ### isFailed

    public boolean isFailed()
    Returns:
      `true` if a task associated with this context has permanently failed

  - ### failedPermanently

    public CSCertificateTaskFailedPermanently failedPermanently(Exception exception)
    Mark this context as permanently failed due to the given exception, and return a failed permanently status.
    Parameters:
      `exception` - The exception
    Returns:
      The failed status

  - ### createOrGetOrder

    public org.shredzone.acme4j.Order createOrGetOrder() throws org.shredzone.acme4j.exception.AcmeException
    Create or get an order for this domain and certificate.
    Returns:
      The order
    Throws:
      `org.shredzone.acme4j.exception.AcmeException` - On errors

  - ### destroyOrder

    public void destroyOrder()
    Destroy the current order.