# 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, 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()`
  `CSDNSQueriesFactoryType`
  `dnsQueries()`
  `void`
  `dnsRecordCreated(String name, String text)`
  A DNS record was created.
  `List<CSDNSTXTRecord>`
  `dnsRecordsCreated()`
  `CSDomain`
  `domain()`
  `CSEventServiceType`
  `events()`
  `CSCertificateTaskStatusType.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, 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
      `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 CSCertificateTaskStatusType.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