From d28d22f06650109860ffead6e2c24872fe3aff88 Mon Sep 17 00:00:00 2001 From: James Hateley Date: Wed, 29 Jul 2026 13:25:03 +1000 Subject: [PATCH 1/2] fix: Replace build-time OpenAPI generated models Signed-off-by: James Hateley --- README.md | 2 +- .../com/godaddy/ans/sdk/agent/AnsClient.java | 4 +- .../sdk/agent/connection/AgentConnection.java | 6 +- .../agent/connection/AgentConnectionTest.java | 8 +- ans-sdk-api/build.gradle.kts | 53 +- .../godaddy/ans/sdk/model/AgentDetails.java | 475 +++++++++++++++++ .../godaddy/ans/sdk/model/AgentEndpoint.java | 331 ++++++++++++ .../godaddy/ans/sdk/model/AgentFunction.java | 155 ++++++ .../ans/sdk/model/AgentLifecycleStatus.java | 51 ++ .../sdk/model/AgentLifecycleStatusFilter.java | 47 ++ .../ans/sdk/model/AgentListResponse.java | 218 ++++++++ .../model/AgentListResponseItemsInner.java | 406 +++++++++++++++ .../sdk/model/AgentRegistrationRequest.java | 395 +++++++++++++++ .../ans/sdk/model/AgentRevocationRequest.java | 114 +++++ .../sdk/model/AgentRevocationResponse.java | 285 +++++++++++ .../godaddy/ans/sdk/model/AgentStatus.java | 326 ++++++++++++ .../ans/sdk/model/CatalogAttestation.java | 147 ++++++ .../ans/sdk/model/CatalogDocument.java | 157 ++++++ .../godaddy/ans/sdk/model/CatalogEntry.java | 439 ++++++++++++++++ .../ans/sdk/model/CatalogEntryMetadata.java | 149 ++++++ .../ans/sdk/model/CatalogHostInfo.java | 115 +++++ .../godaddy/ans/sdk/model/CatalogNested.java | 124 +++++ .../ans/sdk/model/CatalogPublisher.java | 145 ++++++ .../ans/sdk/model/CatalogTrustManifest.java | 126 +++++ .../ans/sdk/model/CertificateResponse.java | 361 +++++++++++++ .../godaddy/ans/sdk/model/ChallengeInfo.java | 273 ++++++++++ .../ans/sdk/model/ChallengeInfoDnsRecord.java | 143 ++++++ .../ans/sdk/model/CsrStatusResponse.java | 310 ++++++++++++ .../ans/sdk/model/CsrSubmissionRequest.java | 83 +++ .../ans/sdk/model/CsrSubmissionResponse.java | 116 +++++ .../ans/sdk/model/DiscoveryProfile.java | 41 ++ .../com/godaddy/ans/sdk/model/DnsRecord.java | 347 +++++++++++++ .../ans/sdk/model/DnsVerificationError.java | 199 ++++++++ ...erificationErrorIncorrectRecordsInner.java | 144 ++++++ .../godaddy/ans/sdk/model/ErrorResponse.java | 222 ++++++++ .../com/godaddy/ans/sdk/model/EventItem.java | 477 ++++++++++++++++++ .../ans/sdk/model/EventPageResponse.java | 126 +++++ .../sdk/model/IdentityChallengeResponse.java | 395 +++++++++++++++ .../ans/sdk/model/IdentityDetails.java | 418 +++++++++++++++ .../IdentityDetailsLinkedAgentsInner.java | 117 +++++ .../sdk/model/IdentityLifecycleStatus.java | 44 ++ .../ans/sdk/model/IdentityLinkRequest.java | 96 ++++ .../ans/sdk/model/IdentityLinkResponse.java | 83 +++ .../ans/sdk/model/IdentityListResponse.java | 217 ++++++++ .../ans/sdk/model/IdentityProofChallenge.java | 116 +++++ .../model/IdentityRegistrationRequest.java | 115 +++++ .../java/com/godaddy/ans/sdk/model/Link.java | 116 +++++ .../godaddy/ans/sdk/model/LinkedIdentity.java | 284 +++++++++++ .../com/godaddy/ans/sdk/model/NextStep.java | 220 ++++++++ .../com/godaddy/ans/sdk/model/Problem.java | 208 ++++++++ .../com/godaddy/ans/sdk/model/Protocol.java | 43 ++ .../ans/sdk/model/RegistrationPending.java | 374 ++++++++++++++ .../ans/sdk/model/RenewalStatusResponse.java | 379 ++++++++++++++ .../sdk/model/RenewalSubmissionResponse.java | 353 +++++++++++++ .../RenewalSubmissionResponseChallenges.java | 118 +++++ .../model/RenewalVerificationResponse.java | 217 ++++++++ .../ans/sdk/model/RevocationReason.java | 51 ++ .../ServerCertificateRenewalRequest.java | 144 ++++++ .../ans/sdk/model/VLEIPresentation.java | 88 ++++ .../ans/sdk/model/VerifyControlRequest.java | 132 +++++ .../ans/sdk/model/AgentDetailsTest.java | 85 ++++ .../ans/sdk/model/AgentEndpointTest.java | 77 +++ .../ans/sdk/model/AgentFunctionTest.java | 57 +++ .../model/AgentLifecycleStatusFilterTest.java | 30 ++ .../sdk/model/AgentLifecycleStatusTest.java | 30 ++ .../AgentListResponseItemsInnerTest.java | 75 +++ .../ans/sdk/model/AgentListResponseTest.java | 59 +++ .../model/AgentRegistrationRequestTest.java | 65 +++ .../sdk/model/AgentRevocationRequestTest.java | 46 ++ .../model/AgentRevocationResponseTest.java | 71 +++ .../ans/sdk/model/AgentStatusTest.java | 76 +++ .../ans/sdk/model/CatalogAttestationTest.java | 49 ++ .../ans/sdk/model/CatalogDocumentTest.java | 57 +++ .../sdk/model/CatalogEntryMetadataTest.java | 49 ++ .../ans/sdk/model/CatalogEntryTest.java | 68 +++ .../ans/sdk/model/CatalogHostInfoTest.java | 46 ++ .../ans/sdk/model/CatalogNestedTest.java | 55 ++ .../ans/sdk/model/CatalogPublisherTest.java | 47 ++ .../sdk/model/CatalogTrustManifestTest.java | 56 ++ .../sdk/model/CertificateResponseTest.java | 57 +++ .../sdk/model/ChallengeInfoDnsRecordTest.java | 47 ++ .../ans/sdk/model/ChallengeInfoTest.java | 59 +++ .../ans/sdk/model/CsrStatusResponseTest.java | 62 +++ .../sdk/model/CsrSubmissionRequestTest.java | 45 ++ .../sdk/model/CsrSubmissionResponseTest.java | 48 ++ .../ans/sdk/model/DiscoveryProfileTest.java | 31 ++ .../godaddy/ans/sdk/model/DnsRecordTest.java | 60 +++ ...icationErrorIncorrectRecordsInnerTest.java | 49 ++ .../sdk/model/DnsVerificationErrorTest.java | 72 +++ .../ans/sdk/model/ErrorResponseTest.java | 57 +++ .../godaddy/ans/sdk/model/EventItemTest.java | 75 +++ .../ans/sdk/model/EventPageResponseTest.java | 56 ++ .../model/IdentityChallengeResponseTest.java | 72 +++ .../IdentityDetailsLinkedAgentsInnerTest.java | 50 ++ .../ans/sdk/model/IdentityDetailsTest.java | 73 +++ .../model/IdentityLifecycleStatusTest.java | 30 ++ .../sdk/model/IdentityLinkRequestTest.java | 56 ++ .../sdk/model/IdentityLinkResponseTest.java | 45 ++ .../sdk/model/IdentityListResponseTest.java | 59 +++ .../sdk/model/IdentityProofChallengeTest.java | 46 ++ .../IdentityRegistrationRequestTest.java | 46 ++ .../com/godaddy/ans/sdk/model/LinkTest.java | 48 ++ .../ans/sdk/model/LinkedIdentityTest.java | 60 +++ .../ans/sdk/model/ModelTestSupport.java | 22 + .../godaddy/ans/sdk/model/NextStepTest.java | 57 +++ .../godaddy/ans/sdk/model/ProblemTest.java | 49 ++ .../godaddy/ans/sdk/model/ProtocolTest.java | 33 ++ .../sdk/model/RegistrationPendingTest.java | 95 ++++ .../sdk/model/RenewalStatusResponseTest.java | 64 +++ ...newalSubmissionResponseChallengesTest.java | 47 ++ .../model/RenewalSubmissionResponseTest.java | 72 +++ .../RenewalVerificationResponseTest.java | 57 +++ .../ans/sdk/model/RevocationReasonTest.java | 30 ++ .../ServerCertificateRenewalRequestTest.java | 47 ++ .../ans/sdk/model/VLEIPresentationTest.java | 45 ++ .../sdk/model/VerifyControlRequestTest.java | 56 ++ .../ans/sdk/discovery/DiscoveryClient.java | 2 +- .../ans/sdk/discovery/ResolutionService.java | 2 +- .../sdk/discovery/DiscoveryClientTest.java | 4 +- .../sdk/registration/CertificateService.java | 2 +- .../sdk/registration/RegistrationClient.java | 12 +- .../sdk/registration/RegistrationService.java | 14 +- .../registration/ApiVersionRoutingTest.java | 10 +- .../registration/CertificateServiceTest.java | 2 +- .../registration/RegistrationClientTest.java | 20 +- .../examples/springboot/AgentController.java | 4 +- 126 files changed, 14501 insertions(+), 94 deletions(-) create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentFunction.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatus.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilter.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInner.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRegistrationRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentStatus.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogAttestation.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogDocument.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntry.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntryMetadata.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogHostInfo.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogNested.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogPublisher.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogTrustManifest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CertificateResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfo.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecord.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrStatusResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DiscoveryProfile.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsRecord.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationError.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInner.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ErrorResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventItem.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventPageResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityChallengeResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetails.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInner.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatus.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityProofChallenge.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Link.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/LinkedIdentity.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/NextStep.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Problem.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Protocol.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RegistrationPending.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalStatusResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallenges.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalVerificationResponse.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RevocationReason.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequest.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VLEIPresentation.java create mode 100644 ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VerifyControlRequest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentDetailsTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentEndpointTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentFunctionTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilterTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInnerTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRegistrationRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentStatusTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogAttestationTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogDocumentTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryMetadataTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogHostInfoTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogNestedTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogPublisherTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogTrustManifestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CertificateResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecordTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrStatusResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DiscoveryProfileTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsRecordTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInnerTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ErrorResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventItemTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventPageResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityChallengeResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInnerTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatusTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityListResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityProofChallengeTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkedIdentityTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ModelTestSupport.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/NextStepTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProblemTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProtocolTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RegistrationPendingTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalStatusResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallengesTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalVerificationResponseTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RevocationReasonTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequestTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VLEIPresentationTest.java create mode 100644 ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VerifyControlRequestTest.java diff --git a/README.md b/README.md index 32e0287..70d4a51 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Java SDK for the Agent Name Service (ANS) Registry. This SDK provides clients fo The ANS Registry SDK is based off of the REST API. The spec is documented using the OpenAPI specification: - [ANS OpenAPI Spec (ans repo)](https://github.com/agentnameservice/ans/blob/main/spec/api-spec-v2.yaml) -- Local copy used for code generation: [`ans-sdk-api/spec/api-spec.yaml`](ans-sdk-api/spec/api-spec.yaml) +- Local copy for reference: [`ans-sdk-api/spec/api-spec.yaml`](ans-sdk-api/spec/api-spec.yaml) ## Requirements diff --git a/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/AnsClient.java b/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/AnsClient.java index a4dbb09..35ddb34 100644 --- a/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/AnsClient.java +++ b/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/AnsClient.java @@ -5,8 +5,8 @@ import com.godaddy.ans.sdk.agent.http.DefaultAgentHttpClientFactory; import com.godaddy.ans.sdk.agent.http.VerifiedClientResult; import com.godaddy.ans.sdk.agent.verification.DaneTlsaVerifier; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentLifecycleStatus; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentLifecycleStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/connection/AgentConnection.java b/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/connection/AgentConnection.java index 4c71332..81f832a 100644 --- a/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/connection/AgentConnection.java +++ b/ans-sdk-agent-client/src/main/java/com/godaddy/ans/sdk/agent/connection/AgentConnection.java @@ -3,9 +3,9 @@ import com.godaddy.ans.sdk.agent.http.auth.HttpAuthHeadersProvider; import com.godaddy.ans.sdk.agent.http.AnsHttpClient; import com.godaddy.ans.sdk.agent.protocol.HttpApiClient; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentEndpoint; -import com.godaddy.ans.sdk.model.generated.Protocol; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentEndpoint; +import com.godaddy.ans.sdk.model.Protocol; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ans-sdk-agent-client/src/test/java/com/godaddy/ans/sdk/agent/connection/AgentConnectionTest.java b/ans-sdk-agent-client/src/test/java/com/godaddy/ans/sdk/agent/connection/AgentConnectionTest.java index 7c6375a..b5006de 100644 --- a/ans-sdk-agent-client/src/test/java/com/godaddy/ans/sdk/agent/connection/AgentConnectionTest.java +++ b/ans-sdk-agent-client/src/test/java/com/godaddy/ans/sdk/agent/connection/AgentConnectionTest.java @@ -2,10 +2,10 @@ import com.godaddy.ans.sdk.agent.http.AnsHttpClient; import com.godaddy.ans.sdk.agent.protocol.HttpApiClient; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentEndpoint; -import com.godaddy.ans.sdk.model.generated.AgentLifecycleStatus; -import com.godaddy.ans.sdk.model.generated.Protocol; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentEndpoint; +import com.godaddy.ans.sdk.model.AgentLifecycleStatus; +import com.godaddy.ans.sdk.model.Protocol; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/ans-sdk-api/build.gradle.kts b/ans-sdk-api/build.gradle.kts index 24c110b..7972dc4 100644 --- a/ans-sdk-api/build.gradle.kts +++ b/ans-sdk-api/build.gradle.kts @@ -1,13 +1,6 @@ -import java.net.URI - -plugins { - id("org.openapi.generator") -} - val jacksonVersion: String by project - -// Authoritative source for the API spec -val apiSpecFile = layout.projectDirectory.file("spec/api-spec.yaml") +val junitVersion: String by project +val assertjVersion: String by project dependencies { // Jackson for JSON serialization @@ -17,44 +10,8 @@ dependencies { // Jakarta annotations implementation("jakarta.annotation:jakarta.annotation-api:3.0.0") -} - -openApiGenerate { - generatorName.set("java") - inputSpec.set(apiSpecFile) - skipValidateSpec.set(true) - outputDir.set(layout.buildDirectory.dir("generated").get().asFile.absolutePath) - apiPackage.set("com.godaddy.ans.sdk.api.generated") - modelPackage.set("com.godaddy.ans.sdk.model.generated") - invokerPackage.set("com.godaddy.ans.sdk.client.generated") - configOptions.set(mapOf( - "library" to "native", - "dateLibrary" to "java8", - "useJakartaEe" to "true", - "openApiNullable" to "false", - "serializationLibrary" to "jackson", - "hideGenerationTimestamp" to "true" - )) -} - -sourceSets { - main { - java { - srcDir(layout.buildDirectory.dir("generated/src/main/java")) - } - } -} -tasks.compileJava { - dependsOn(tasks.openApiGenerate) + // Testing + testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + testImplementation("org.assertj:assertj-core:$assertjVersion") } - -// Disable checkstyle for generated code -tasks.named("checkstyleMain") { - enabled = false -} - -// Ensure all jar tasks (including sources/javadoc jars created by the publish plugin) wait for code generation. -tasks.withType().configureEach { - dependsOn(tasks.openApiGenerate) -} \ No newline at end of file diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java new file mode 100644 index 0000000..0603fab --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java @@ -0,0 +1,475 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentDetails + */ +@JsonPropertyOrder({ + AgentDetails.JSON_PROPERTY_AGENT_ID, + AgentDetails.JSON_PROPERTY_AGENT_DISPLAY_NAME, + AgentDetails.JSON_PROPERTY_AGENT_DESCRIPTION, + AgentDetails.JSON_PROPERTY_VERSION, + AgentDetails.JSON_PROPERTY_AGENT_HOST, + AgentDetails.JSON_PROPERTY_ENDPOINTS, + AgentDetails.JSON_PROPERTY_ANS_NAME, + AgentDetails.JSON_PROPERTY_AGENT_STATUS, + AgentDetails.JSON_PROPERTY_REGISTRATION_TIMESTAMP, + AgentDetails.JSON_PROPERTY_LAST_RENEWAL_TIMESTAMP, + AgentDetails.JSON_PROPERTY_REGISTRATION_PENDING, + AgentDetails.JSON_PROPERTY_LINKS, + AgentDetails.JSON_PROPERTY_IDENTITIES +})public class AgentDetails { + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + @Nonnull + private UUID agentId; + + public static final String JSON_PROPERTY_AGENT_DISPLAY_NAME = "agentDisplayName"; + + @Nonnull + private String agentDisplayName; + + public static final String JSON_PROPERTY_AGENT_DESCRIPTION = "agentDescription"; + + @Nullable + private String agentDescription; + + public static final String JSON_PROPERTY_VERSION = "version"; + + @Nonnull + private String version; + + public static final String JSON_PROPERTY_AGENT_HOST = "agentHost"; + + @Nonnull + private String agentHost; + + public static final String JSON_PROPERTY_ENDPOINTS = "endpoints"; + + @Nonnull + private List endpoints = new ArrayList<>(); + + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_AGENT_STATUS = "agentStatus"; + + @Nonnull + private AgentLifecycleStatus agentStatus; + + public static final String JSON_PROPERTY_REGISTRATION_TIMESTAMP = "registrationTimestamp"; + + @Nullable + private OffsetDateTime registrationTimestamp; + + public static final String JSON_PROPERTY_LAST_RENEWAL_TIMESTAMP = "lastRenewalTimestamp"; + + @Nullable + private OffsetDateTime lastRenewalTimestamp; + + public static final String JSON_PROPERTY_REGISTRATION_PENDING = "registrationPending"; + + @Nullable + private RegistrationPending registrationPending; + + public static final String JSON_PROPERTY_LINKS = "links"; + + @Nonnull + private List links = new ArrayList<>(); + + public static final String JSON_PROPERTY_IDENTITIES = "identities"; + + @Nullable + private List identities = new ArrayList<>(); + + public AgentDetails() { + } + + public AgentDetails agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Get agentId + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public AgentDetails agentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + return this; + } + + /** + * Get agentDisplayName + * @return agentDisplayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentDisplayName() { + return agentDisplayName; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + } + + public AgentDetails agentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + return this; + } + + /** + * Get agentDescription + * @return agentDescription + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAgentDescription() { + return agentDescription; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + } + + public AgentDetails version(@Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setVersion(@Nonnull String version) { + this.version = version; + } + + public AgentDetails agentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + return this; + } + + /** + * Get agentHost + * @return agentHost + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentHost() { + return agentHost; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + } + + public AgentDetails endpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + return this; + } + + public AgentDetails addEndpointsItem(AgentEndpoint endpointsItem) { + if (this.endpoints == null) { + this.endpoints = new ArrayList<>(); + } + this.endpoints.add(endpointsItem); + return this; + } + + /** + * Get endpoints + * @return endpoints + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEndpoints() { + return endpoints; + } + + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEndpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + } + + public AgentDetails ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Get ansName + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public AgentDetails agentStatus(@Nonnull AgentLifecycleStatus agentStatus) { + this.agentStatus = agentStatus; + return this; + } + + /** + * Get agentStatus + * @return agentStatus + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentLifecycleStatus getAgentStatus() { + return agentStatus; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentStatus(@Nonnull AgentLifecycleStatus agentStatus) { + this.agentStatus = agentStatus; + } + + public AgentDetails registrationTimestamp(@Nullable OffsetDateTime registrationTimestamp) { + this.registrationTimestamp = registrationTimestamp; + return this; + } + + /** + * Get registrationTimestamp + * @return registrationTimestamp + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getRegistrationTimestamp() { + return registrationTimestamp; + } + + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRegistrationTimestamp(@Nullable OffsetDateTime registrationTimestamp) { + this.registrationTimestamp = registrationTimestamp; + } + + public AgentDetails lastRenewalTimestamp(@Nullable OffsetDateTime lastRenewalTimestamp) { + this.lastRenewalTimestamp = lastRenewalTimestamp; + return this; + } + + /** + * Get lastRenewalTimestamp + * @return lastRenewalTimestamp + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LAST_RENEWAL_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getLastRenewalTimestamp() { + return lastRenewalTimestamp; + } + + @JsonProperty(value = JSON_PROPERTY_LAST_RENEWAL_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastRenewalTimestamp(@Nullable OffsetDateTime lastRenewalTimestamp) { + this.lastRenewalTimestamp = lastRenewalTimestamp; + } + + public AgentDetails registrationPending(@Nullable RegistrationPending registrationPending) { + this.registrationPending = registrationPending; + return this; + } + + /** + * Get registrationPending + * @return registrationPending + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_PENDING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RegistrationPending getRegistrationPending() { + return registrationPending; + } + + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_PENDING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRegistrationPending(@Nullable RegistrationPending registrationPending) { + this.registrationPending = registrationPending; + } + + public AgentDetails links(@Nonnull List links) { + this.links = links; + return this; + } + + public AgentDetails addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getLinks() { + return links; + } + + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLinks(@Nonnull List links) { + this.links = links; + } + + public AgentDetails identities(@Nullable List identities) { + this.identities = identities; + return this; + } + + public AgentDetails addIdentitiesItem(LinkedIdentity identitiesItem) { + if (this.identities == null) { + this.identities = new ArrayList<>(); + } + this.identities.add(identitiesItem); + return this; + } + + /** + * Additive, optional, COMPUTED — the verified identities currently linked to this agent, joined from the link rows + * at read time. Never stored on the registration; identity rotation/revocation is visible here immediately with + * zero agent-side writes. + * @return identities + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_IDENTITIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIdentities() { + return identities; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIdentities(@Nullable List identities) { + this.identities = identities; + } + + /** + * Return true if this AgentDetails object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentDetails agentDetails = (AgentDetails) o; + return Objects.equals(this.agentId, agentDetails.agentId) && + Objects.equals(this.agentDisplayName, agentDetails.agentDisplayName) && + Objects.equals(this.agentDescription, agentDetails.agentDescription) && + Objects.equals(this.version, agentDetails.version) && + Objects.equals(this.agentHost, agentDetails.agentHost) && + Objects.equals(this.endpoints, agentDetails.endpoints) && + Objects.equals(this.ansName, agentDetails.ansName) && + Objects.equals(this.agentStatus, agentDetails.agentStatus) && + Objects.equals(this.registrationTimestamp, agentDetails.registrationTimestamp) && + Objects.equals(this.lastRenewalTimestamp, agentDetails.lastRenewalTimestamp) && + Objects.equals(this.registrationPending, agentDetails.registrationPending) && + Objects.equals(this.links, agentDetails.links) && + Objects.equals(this.identities, agentDetails.identities); + } + + @Override + public int hashCode() { + return Objects.hash(agentId, agentDisplayName, agentDescription, version, agentHost, endpoints, ansName, + agentStatus, registrationTimestamp, lastRenewalTimestamp, registrationPending, links, identities); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentDetails {\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" agentDisplayName: ").append(toIndentedString(agentDisplayName)).append("\n"); + sb.append(" agentDescription: ").append(toIndentedString(agentDescription)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" agentHost: ").append(toIndentedString(agentHost)).append("\n"); + sb.append(" endpoints: ").append(toIndentedString(endpoints)).append("\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" agentStatus: ").append(toIndentedString(agentStatus)).append("\n"); + sb.append(" registrationTimestamp: ").append(toIndentedString(registrationTimestamp)).append("\n"); + sb.append(" lastRenewalTimestamp: ").append(toIndentedString(lastRenewalTimestamp)).append("\n"); + sb.append(" registrationPending: ").append(toIndentedString(registrationPending)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" identities: ").append(toIndentedString(identities)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java new file mode 100644 index 0000000..df66761 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java @@ -0,0 +1,331 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentEndpoint + */ +@JsonPropertyOrder({ + AgentEndpoint.JSON_PROPERTY_AGENT_URL, + AgentEndpoint.JSON_PROPERTY_META_DATA_URL, + AgentEndpoint.JSON_PROPERTY_META_DATA_HASH, + AgentEndpoint.JSON_PROPERTY_DOCUMENTATION_URL, + AgentEndpoint.JSON_PROPERTY_PROTOCOL, + AgentEndpoint.JSON_PROPERTY_FUNCTIONS, + AgentEndpoint.JSON_PROPERTY_TRANSPORTS +})public class AgentEndpoint { + public static final String JSON_PROPERTY_AGENT_URL = "agentUrl"; + + + @Nonnull + private URI agentUrl; + + public static final String JSON_PROPERTY_META_DATA_URL = "metaDataUrl"; + + @Nullable + private URI metaDataUrl; + + public static final String JSON_PROPERTY_META_DATA_HASH = "metaDataHash"; + + @Nullable + private String metaDataHash; + + public static final String JSON_PROPERTY_DOCUMENTATION_URL = "documentationUrl"; + + @Nullable + private URI documentationUrl; + + public static final String JSON_PROPERTY_PROTOCOL = "protocol"; + + + @Nonnull + private Protocol protocol; + + public static final String JSON_PROPERTY_FUNCTIONS = "functions"; + + @Nullable + private List functions = new ArrayList<>(); + + /** + * Gets or Sets transports + */ + public enum TransportsEnum { + STREAMABLE_HTTP("STREAMABLE_HTTP"), + + SSE("SSE"), + + JSON_RPC("JSON_RPC"), + + GRPC("GRPC"), + + REST("REST"), + + HTTP("HTTP"); + + private String value; + + TransportsEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static TransportsEnum fromValue(String value) { + for (TransportsEnum b : TransportsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TRANSPORTS = "transports"; + + @Nullable + private List transports = new ArrayList<>(); + + public AgentEndpoint() { + } + + public AgentEndpoint agentUrl(@Nonnull URI agentUrl) { + this.agentUrl = agentUrl; + return this; + } + + /** + * Get agentUrl + * @return agentUrl + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public URI getAgentUrl() { + return agentUrl; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_URL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentUrl(@Nonnull URI agentUrl) { + this.agentUrl = agentUrl; + } + + public AgentEndpoint metaDataUrl(@Nullable URI metaDataUrl) { + this.metaDataUrl = metaDataUrl; + return this; + } + + /** + * Optional. The endpoint's metadata descriptor URL. Must be https and free of whitespace, quotes, and other characters that require SVCB presentation escaping — it is emitted verbatim as the ANS_DNSAID `cap` SvcParam (key65400) and is the document `cap-sha256` (key65401) digests. When it sits at https://{agentHost}/.well-known/<suffix>, the suffix is also advertised as the `well-known` SvcParam (key65409). NOTE: a `cap` whose host differs from the agent FQDN is published without an integrity pin unless metaDataHash is also supplied — consumers SHOULD prefer a metaDataHash-pinned descriptor for off-host metadata. + * @return metaDataUrl + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_META_DATA_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public URI getMetaDataUrl() { + return metaDataUrl; + } + + @JsonProperty(value = JSON_PROPERTY_META_DATA_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMetaDataUrl(@Nullable URI metaDataUrl) { + this.metaDataUrl = metaDataUrl; + } + + public AgentEndpoint metaDataHash(@Nullable String metaDataHash) { + this.metaDataHash = metaDataHash; + return this; + } + + /** + * Optional integrity pin over the metadata descriptor. Meaningless on its own: it MUST be accompanied by + * metaDataUrl. A metaDataHash without a metaDataUrl is rejected with 422 INVALID_ENDPOINT. + * @return metaDataHash + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_META_DATA_HASH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMetaDataHash() { + return metaDataHash; + } + + @JsonProperty(value = JSON_PROPERTY_META_DATA_HASH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMetaDataHash(@Nullable String metaDataHash) { + this.metaDataHash = metaDataHash; + } + + public AgentEndpoint documentationUrl(@Nullable URI documentationUrl) { + this.documentationUrl = documentationUrl; + return this; + } + + /** + * Get documentationUrl + * @return documentationUrl + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DOCUMENTATION_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public URI getDocumentationUrl() { + return documentationUrl; + } + + @JsonProperty(value = JSON_PROPERTY_DOCUMENTATION_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDocumentationUrl(@Nullable URI documentationUrl) { + this.documentationUrl = documentationUrl; + } + + public AgentEndpoint protocol(@Nonnull Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * @return protocol + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_PROTOCOL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Protocol getProtocol() { + return protocol; + } + + @JsonProperty(value = JSON_PROPERTY_PROTOCOL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setProtocol(@Nonnull Protocol protocol) { + this.protocol = protocol; + } + + public AgentEndpoint functions(@Nullable List functions) { + this.functions = functions; + return this; + } + + public AgentEndpoint addFunctionsItem(AgentFunction functionsItem) { + if (this.functions == null) { + this.functions = new ArrayList<>(); + } + this.functions.add(functionsItem); + return this; + } + + /** + * Get functions + * @return functions + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_FUNCTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFunctions() { + return functions; + } + + @JsonProperty(value = JSON_PROPERTY_FUNCTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFunctions(@Nullable List functions) { + this.functions = functions; + } + + public AgentEndpoint transports(@Nullable List transports) { + this.transports = transports; + return this; + } + + public AgentEndpoint addTransportsItem(TransportsEnum transportsItem) { + if (this.transports == null) { + this.transports = new ArrayList<>(); + } + this.transports.add(transportsItem); + return this; + } + + /** + * Get transports + * @return transports + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TRANSPORTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTransports() { + return transports; + } + + @JsonProperty(value = JSON_PROPERTY_TRANSPORTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransports(@Nullable List transports) { + this.transports = transports; + } + + /** + * Return true if this AgentEndpoint object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentEndpoint agentEndpoint = (AgentEndpoint) o; + return Objects.equals(this.agentUrl, agentEndpoint.agentUrl) && + Objects.equals(this.metaDataUrl, agentEndpoint.metaDataUrl) && + Objects.equals(this.metaDataHash, agentEndpoint.metaDataHash) && + Objects.equals(this.documentationUrl, agentEndpoint.documentationUrl) && + Objects.equals(this.protocol, agentEndpoint.protocol) && + Objects.equals(this.functions, agentEndpoint.functions) && + Objects.equals(this.transports, agentEndpoint.transports); + } + + @Override + public int hashCode() { + return Objects.hash(agentUrl, metaDataUrl, metaDataHash, documentationUrl, protocol, functions, transports); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentEndpoint {\n"); + sb.append(" agentUrl: ").append(toIndentedString(agentUrl)).append("\n"); + sb.append(" metaDataUrl: ").append(toIndentedString(metaDataUrl)).append("\n"); + sb.append(" metaDataHash: ").append(toIndentedString(metaDataHash)).append("\n"); + sb.append(" documentationUrl: ").append(toIndentedString(documentationUrl)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).append("\n"); + sb.append(" functions: ").append(toIndentedString(functions)).append("\n"); + sb.append(" transports: ").append(toIndentedString(transports)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentFunction.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentFunction.java new file mode 100644 index 0000000..57e1411 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentFunction.java @@ -0,0 +1,155 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentFunction + */ +@JsonPropertyOrder({ + AgentFunction.JSON_PROPERTY_ID, + AgentFunction.JSON_PROPERTY_NAME, + AgentFunction.JSON_PROPERTY_TAGS +}) +public class AgentFunction { + public static final String JSON_PROPERTY_ID = "id"; + + @Nonnull + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + + @Nonnull + private String name; + + public static final String JSON_PROPERTY_TAGS = "tags"; + + @Nullable + private List tags = new ArrayList<>(); + + public AgentFunction() { + } + + public AgentFunction id(@Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@Nonnull String id) { + this.id = id; + } + + public AgentFunction name(@Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@Nonnull String name) { + this.name = name; + } + + public AgentFunction tags(@Nullable List tags) { + this.tags = tags; + return this; + } + + public AgentFunction addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@Nullable List tags) { + this.tags = tags; + } + + /** + * Return true if this AgentFunction object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentFunction agentFunction = (AgentFunction) o; + return Objects.equals(this.id, agentFunction.id) && + Objects.equals(this.name, agentFunction.name) && + Objects.equals(this.tags, agentFunction.tags); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentFunction {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatus.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatus.java new file mode 100644 index 0000000..c94d6bc --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatus.java @@ -0,0 +1,51 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets AgentLifecycleStatus + */ +public enum AgentLifecycleStatus { + + PENDING_VALIDATION("PENDING_VALIDATION"), + + PENDING_DNS("PENDING_DNS"), + + ACTIVE("ACTIVE"), + + FAILED("FAILED"), + + EXPIRED("EXPIRED"), + + DEPRECATED("DEPRECATED"), + + REVOKED("REVOKED"); + + private String value; + + AgentLifecycleStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static AgentLifecycleStatus fromValue(String value) { + for (AgentLifecycleStatus b : AgentLifecycleStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilter.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilter.java new file mode 100644 index 0000000..6ca5cd5 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilter.java @@ -0,0 +1,47 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets AgentLifecycleStatusFilter + */ +public enum AgentLifecycleStatusFilter { + + PENDING_DNS("PENDING_DNS"), + + ACTIVE("ACTIVE"), + + DEPRECATED("DEPRECATED"), + + REVOKED("REVOKED"), + + ALL("ALL"); + + private String value; + + AgentLifecycleStatusFilter(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static AgentLifecycleStatusFilter fromValue(String value) { + for (AgentLifecycleStatusFilter b : AgentLifecycleStatusFilter.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponse.java new file mode 100644 index 0000000..c6275c8 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponse.java @@ -0,0 +1,218 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Ownership-scoped, cursor-paginated list of the caller's agents. Replaces v1's + * `AgentSearchResponse`. Collection array is named `items` per standard REST collection-response + * conventions. + */ +@JsonPropertyOrder({ + AgentListResponse.JSON_PROPERTY_ITEMS, + AgentListResponse.JSON_PROPERTY_RETURNED_COUNT, + AgentListResponse.JSON_PROPERTY_LIMIT, + AgentListResponse.JSON_PROPERTY_NEXT_CURSOR, + AgentListResponse.JSON_PROPERTY_HAS_MORE +}) +public class AgentListResponse { + public static final String JSON_PROPERTY_ITEMS = "items"; + + @Nonnull + private List items = new ArrayList<>(); + + public static final String JSON_PROPERTY_RETURNED_COUNT = "returnedCount"; + + @Nonnull + private Integer returnedCount; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + + @Nonnull + private Integer limit; + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + + @Nullable + private String nextCursor; + + public static final String JSON_PROPERTY_HAS_MORE = "hasMore"; + + @Nonnull + private Boolean hasMore; + + public AgentListResponse() { + } + + public AgentListResponse items(@Nonnull List items) { + this.items = items; + return this; + } + + public AgentListResponse addItemsItem(AgentListResponseItemsInner itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of agents owned by the caller + * @return items + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getItems() { + return items; + } + + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setItems(@Nonnull List items) { + this.items = items; + } + + public AgentListResponse returnedCount(@Nonnull Integer returnedCount) { + this.returnedCount = returnedCount; + return this; + } + + /** + * Number of agents in this response + * @return returnedCount + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_RETURNED_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getReturnedCount() { + return returnedCount; + } + + @JsonProperty(value = JSON_PROPERTY_RETURNED_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReturnedCount(@Nonnull Integer returnedCount) { + this.returnedCount = returnedCount; + } + + public AgentListResponse limit(@Nonnull Integer limit) { + this.limit = limit; + return this; + } + + /** + * Limit that was applied + * @return limit + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getLimit() { + return limit; + } + + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLimit(@Nonnull Integer limit) { + this.limit = limit; + } + + public AgentListResponse nextCursor(@Nullable String nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + /** + * Opaque cursor for the next page. Pass as the `cursor` query parameter to retrieve the next page. Null + * when there are no more results. + * @return nextCursor + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNextCursor() { + return nextCursor; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNextCursor(@Nullable String nextCursor) { + this.nextCursor = nextCursor; + } + + public AgentListResponse hasMore(@Nonnull Boolean hasMore) { + this.hasMore = hasMore; + return this; + } + + /** + * Whether more results exist beyond this page + * @return hasMore + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasMore() { + return hasMore; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setHasMore(@Nonnull Boolean hasMore) { + this.hasMore = hasMore; + } + + /** + * Return true if this AgentListResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentListResponse agentListResponse = (AgentListResponse) o; + return Objects.equals(this.items, agentListResponse.items) && + Objects.equals(this.returnedCount, agentListResponse.returnedCount) && + Objects.equals(this.limit, agentListResponse.limit) && + Objects.equals(this.nextCursor, agentListResponse.nextCursor) && + Objects.equals(this.hasMore, agentListResponse.hasMore); + } + + @Override + public int hashCode() { + return Objects.hash(items, returnedCount, limit, nextCursor, hasMore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" returnedCount: ").append(toIndentedString(returnedCount)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInner.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInner.java new file mode 100644 index 0000000..f6801d2 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInner.java @@ -0,0 +1,406 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentListResponseItemsInner + */ +@JsonPropertyOrder({ + AgentListResponseItemsInner.JSON_PROPERTY_ANS_NAME, + AgentListResponseItemsInner.JSON_PROPERTY_AGENT_ID, + AgentListResponseItemsInner.JSON_PROPERTY_AGENT_DISPLAY_NAME, + AgentListResponseItemsInner.JSON_PROPERTY_AGENT_DESCRIPTION, + AgentListResponseItemsInner.JSON_PROPERTY_VERSION, + AgentListResponseItemsInner.JSON_PROPERTY_AGENT_HOST, + AgentListResponseItemsInner.JSON_PROPERTY_STATUS, + AgentListResponseItemsInner.JSON_PROPERTY_TTL, + AgentListResponseItemsInner.JSON_PROPERTY_REGISTRATION_TIMESTAMP, + AgentListResponseItemsInner.JSON_PROPERTY_ENDPOINTS, + AgentListResponseItemsInner.JSON_PROPERTY_LINKS +}) +public class AgentListResponseItemsInner { + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + @Nonnull + private UUID agentId; + + public static final String JSON_PROPERTY_AGENT_DISPLAY_NAME = "agentDisplayName"; + + @Nonnull + private String agentDisplayName; + + public static final String JSON_PROPERTY_AGENT_DESCRIPTION = "agentDescription"; + + @Nullable + private String agentDescription; + + public static final String JSON_PROPERTY_VERSION = "version"; + + @Nonnull + private String version; + + public static final String JSON_PROPERTY_AGENT_HOST = "agentHost"; + + @Nonnull + private String agentHost; + + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nonnull + private AgentLifecycleStatus status; + + public static final String JSON_PROPERTY_TTL = "ttl"; + + @Nullable + private Integer ttl = 300; + + public static final String JSON_PROPERTY_REGISTRATION_TIMESTAMP = "registrationTimestamp"; + + @Nullable + private OffsetDateTime registrationTimestamp; + + public static final String JSON_PROPERTY_ENDPOINTS = "endpoints"; + + @Nonnull + private List endpoints = new ArrayList<>(); + + public static final String JSON_PROPERTY_LINKS = "links"; + + @Nonnull + private List links = new ArrayList<>(); + + public AgentListResponseItemsInner() { + } + + public AgentListResponseItemsInner ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Get ansName + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public AgentListResponseItemsInner agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Get agentId + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public AgentListResponseItemsInner agentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + return this; + } + + /** + * Get agentDisplayName + * @return agentDisplayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentDisplayName() { + return agentDisplayName; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + } + + public AgentListResponseItemsInner agentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + return this; + } + + /** + * Get agentDescription + * @return agentDescription + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAgentDescription() { + return agentDescription; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + } + + public AgentListResponseItemsInner version(@Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setVersion(@Nonnull String version) { + this.version = version; + } + + public AgentListResponseItemsInner agentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + return this; + } + + /** + * Get agentHost + * @return agentHost + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentHost() { + return agentHost; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + } + + public AgentListResponseItemsInner status(@Nonnull AgentLifecycleStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentLifecycleStatus getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull AgentLifecycleStatus status) { + this.status = status; + } + + public AgentListResponseItemsInner ttl(@Nullable Integer ttl) { + this.ttl = ttl; + return this; + } + + /** + * Get ttl + * @return ttl + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TTL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getTtl() { + return ttl; + } + + @JsonProperty(value = JSON_PROPERTY_TTL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTtl(@Nullable Integer ttl) { + this.ttl = ttl; + } + + public AgentListResponseItemsInner registrationTimestamp(@Nullable OffsetDateTime registrationTimestamp) { + this.registrationTimestamp = registrationTimestamp; + return this; + } + + /** + * Get registrationTimestamp + * @return registrationTimestamp + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getRegistrationTimestamp() { + return registrationTimestamp; + } + + @JsonProperty(value = JSON_PROPERTY_REGISTRATION_TIMESTAMP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRegistrationTimestamp(@Nullable OffsetDateTime registrationTimestamp) { + this.registrationTimestamp = registrationTimestamp; + } + + public AgentListResponseItemsInner endpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + return this; + } + + public AgentListResponseItemsInner addEndpointsItem(AgentEndpoint endpointsItem) { + if (this.endpoints == null) { + this.endpoints = new ArrayList<>(); + } + this.endpoints.add(endpointsItem); + return this; + } + + /** + * Get endpoints + * @return endpoints + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEndpoints() { + return endpoints; + } + + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEndpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + } + + public AgentListResponseItemsInner links(@Nonnull List links) { + this.links = links; + return this; + } + + public AgentListResponseItemsInner addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getLinks() { + return links; + } + + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLinks(@Nonnull List links) { + this.links = links; + } + + /** + * Return true if this AgentListResponse_items_inner object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentListResponseItemsInner agentListResponseItemsInner = (AgentListResponseItemsInner) o; + return Objects.equals(this.ansName, agentListResponseItemsInner.ansName) && + Objects.equals(this.agentId, agentListResponseItemsInner.agentId) && + Objects.equals(this.agentDisplayName, agentListResponseItemsInner.agentDisplayName) && + Objects.equals(this.agentDescription, agentListResponseItemsInner.agentDescription) && + Objects.equals(this.version, agentListResponseItemsInner.version) && + Objects.equals(this.agentHost, agentListResponseItemsInner.agentHost) && + Objects.equals(this.status, agentListResponseItemsInner.status) && + Objects.equals(this.ttl, agentListResponseItemsInner.ttl) && + Objects.equals(this.registrationTimestamp, agentListResponseItemsInner.registrationTimestamp) && + Objects.equals(this.endpoints, agentListResponseItemsInner.endpoints) && + Objects.equals(this.links, agentListResponseItemsInner.links); + } + + @Override + public int hashCode() { + return Objects.hash(ansName, agentId, agentDisplayName, agentDescription, version, agentHost, status, ttl, + registrationTimestamp, endpoints, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentListResponseItemsInner {\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" agentDisplayName: ").append(toIndentedString(agentDisplayName)).append("\n"); + sb.append(" agentDescription: ").append(toIndentedString(agentDescription)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" agentHost: ").append(toIndentedString(agentHost)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" ttl: ").append(toIndentedString(ttl)).append("\n"); + sb.append(" registrationTimestamp: ").append(toIndentedString(registrationTimestamp)).append("\n"); + sb.append(" endpoints: ").append(toIndentedString(endpoints)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRegistrationRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRegistrationRequest.java new file mode 100644 index 0000000..b755899 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRegistrationRequest.java @@ -0,0 +1,395 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentRegistrationRequest + */ +@JsonPropertyOrder({ + AgentRegistrationRequest.JSON_PROPERTY_AGENT_DISPLAY_NAME, + AgentRegistrationRequest.JSON_PROPERTY_AGENT_DESCRIPTION, + AgentRegistrationRequest.JSON_PROPERTY_VERSION, + AgentRegistrationRequest.JSON_PROPERTY_AGENT_HOST, + AgentRegistrationRequest.JSON_PROPERTY_ENDPOINTS, + AgentRegistrationRequest.JSON_PROPERTY_SERVER_CSR_P_E_M, + AgentRegistrationRequest.JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, + AgentRegistrationRequest.JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M, + AgentRegistrationRequest.JSON_PROPERTY_IDENTITY_CSR_P_E_M, + AgentRegistrationRequest.JSON_PROPERTY_DISCOVERY_PROFILES +}) +public class AgentRegistrationRequest { + public static final String JSON_PROPERTY_AGENT_DISPLAY_NAME = "agentDisplayName"; + + @Nonnull + private String agentDisplayName; + + public static final String JSON_PROPERTY_AGENT_DESCRIPTION = "agentDescription"; + + @Nullable + private String agentDescription; + + public static final String JSON_PROPERTY_VERSION = "version"; + + @Nonnull + private String version; + + public static final String JSON_PROPERTY_AGENT_HOST = "agentHost"; + + @Nonnull + private String agentHost; + + public static final String JSON_PROPERTY_ENDPOINTS = "endpoints"; + + @Nonnull + private List endpoints = new ArrayList<>(); + + public static final String JSON_PROPERTY_SERVER_CSR_P_E_M = "serverCsrPEM"; + + @Nullable + private String serverCsrPEM; + + public static final String JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M = "serverCertificatePEM"; + + @Nullable + private String serverCertificatePEM; + + public static final String JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M = "serverCertificateChainPEM"; + + @Nullable + private String serverCertificateChainPEM; + + public static final String JSON_PROPERTY_IDENTITY_CSR_P_E_M = "identityCsrPEM"; + + @Nullable + private String identityCsrPEM; + + public static final String JSON_PROPERTY_DISCOVERY_PROFILES = "discoveryProfiles"; + + @Nullable + private Set discoveryProfiles = new LinkedHashSet<>(Arrays.asList(DiscoveryProfile.ANS_DNSAID)); + + public AgentRegistrationRequest() { + } + + public AgentRegistrationRequest agentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + return this; + } + + /** + * Get agentDisplayName + * @return agentDisplayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentDisplayName() { + return agentDisplayName; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentDisplayName(@Nonnull String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + } + + public AgentRegistrationRequest agentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + return this; + } + + /** + * Get agentDescription + * @return agentDescription + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAgentDescription() { + return agentDescription; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + } + + public AgentRegistrationRequest version(@Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setVersion(@Nonnull String version) { + this.version = version; + } + + public AgentRegistrationRequest agentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + return this; + } + + /** + * Get agentHost + * @return agentHost + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentHost() { + return agentHost; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + } + + public AgentRegistrationRequest endpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + return this; + } + + public AgentRegistrationRequest addEndpointsItem(AgentEndpoint endpointsItem) { + if (this.endpoints == null) { + this.endpoints = new ArrayList<>(); + } + this.endpoints.add(endpointsItem); + return this; + } + + /** + * One or more protocol endpoints. Each protocol may appear at most once across the array — a second endpoint with + * an already-used protocol is rejected with 422 DUPLICATE_PROTOCOL, and an exact protocol+agentUrl repeat with + * 422 DUPLICATE_ENDPOINT. (By-field uniqueness is not expressible in OpenAPI/JSON Schema; enforced in + * internal/domain/endpoint.go AgentEndpoints.Validate.) + * @return endpoints + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEndpoints() { + return endpoints; + } + + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEndpoints(@Nonnull List endpoints) { + this.endpoints = endpoints; + } + + public AgentRegistrationRequest serverCsrPEM(@Nullable String serverCsrPEM) { + this.serverCsrPEM = serverCsrPEM; + return this; + } + + /** + * Get serverCsrPEM + * @return serverCsrPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCsrPEM() { + return serverCsrPEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCsrPEM(@Nullable String serverCsrPEM) { + this.serverCsrPEM = serverCsrPEM; + } + + public AgentRegistrationRequest serverCertificatePEM(@Nullable String serverCertificatePEM) { + this.serverCertificatePEM = serverCertificatePEM; + return this; + } + + /** + * Get serverCertificatePEM + * @return serverCertificatePEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCertificatePEM() { + return serverCertificatePEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCertificatePEM(@Nullable String serverCertificatePEM) { + this.serverCertificatePEM = serverCertificatePEM; + } + + public AgentRegistrationRequest serverCertificateChainPEM(@Nullable String serverCertificateChainPEM) { + this.serverCertificateChainPEM = serverCertificateChainPEM; + return this; + } + + /** + * Get serverCertificateChainPEM + * @return serverCertificateChainPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCertificateChainPEM() { + return serverCertificateChainPEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCertificateChainPEM(@Nullable String serverCertificateChainPEM) { + this.serverCertificateChainPEM = serverCertificateChainPEM; + } + + public AgentRegistrationRequest identityCsrPEM(@Nullable String identityCsrPEM) { + this.identityCsrPEM = identityCsrPEM; + return this; + } + + /** + * Optional. When supplied, the RA issues an identity certificate from this CSR at verify-acme. When omitted, the + * agent registers without an identity certificate and cannot add one later — it must register a new version + * instead. + * @return identityCsrPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_IDENTITY_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIdentityCsrPEM() { + return identityCsrPEM; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIdentityCsrPEM(@Nullable String identityCsrPEM) { + this.identityCsrPEM = identityCsrPEM; + } + + public AgentRegistrationRequest discoveryProfiles(@Nullable Set discoveryProfiles) { + this.discoveryProfiles = discoveryProfiles; + return this; + } + + public AgentRegistrationRequest addDiscoveryProfilesItem(DiscoveryProfile discoveryProfilesItem) { + if (this.discoveryProfiles == null) { + this.discoveryProfiles = new LinkedHashSet<>(Arrays.asList(DiscoveryProfile.ANS_DNSAID)); + } + this.discoveryProfiles.add(discoveryProfilesItem); + return this; + } + + /** + * Set of DNS record families the RA tells the operator to publish and emits in the AGENT_REGISTERED TL event's + * attestations.dnsRecordsProvisioned[]. The computed records surface to the client on GET /v2/ans/agents/{agentId} + * as registrationPending.dnsRecords[] once the agent reaches PENDING_DNS — not on the 202 register response, which + * returns only the ACME challenge (production records are deferred until verify-acme proves domain control and + * issues the certificates the TLSA binding depends on). Each value names one record family; an operator publishing + * the union (DNS-AID-aligned SVCB plus the original `_ans` TXT shape) sends both. Order is not + * significant. Optional. Omitted (or an explicit empty array) normalizes to the default [\"ANS_DNSAID\"] + * server-side; opt into the legacy [\"ANS_TXT\"] shape explicitly. The + * `minItems`/`uniqueItems` schema constraints are the canonical client contract for a present + * array — validate before sending. A non-conformant request (an explicit empty array, or duplicate values) is + * handled defensively rather than rejected: empty is treated as omitted and duplicates are ignored, but conformant + * clients never send either. + * @return discoveryProfiles + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DISCOVERY_PROFILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Set getDiscoveryProfiles() { + return discoveryProfiles; + } + + @JsonDeserialize(as = LinkedHashSet.class) + @JsonProperty(value = JSON_PROPERTY_DISCOVERY_PROFILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDiscoveryProfiles(@Nullable Set discoveryProfiles) { + this.discoveryProfiles = discoveryProfiles; + } + + /** + * Return true if this AgentRegistrationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentRegistrationRequest agentRegistrationRequest = (AgentRegistrationRequest) o; + return Objects.equals(this.agentDisplayName, agentRegistrationRequest.agentDisplayName) && + Objects.equals(this.agentDescription, agentRegistrationRequest.agentDescription) && + Objects.equals(this.version, agentRegistrationRequest.version) && + Objects.equals(this.agentHost, agentRegistrationRequest.agentHost) && + Objects.equals(this.endpoints, agentRegistrationRequest.endpoints) && + Objects.equals(this.serverCsrPEM, agentRegistrationRequest.serverCsrPEM) && + Objects.equals(this.serverCertificatePEM, agentRegistrationRequest.serverCertificatePEM) && + Objects.equals(this.serverCertificateChainPEM, agentRegistrationRequest.serverCertificateChainPEM) && + Objects.equals(this.identityCsrPEM, agentRegistrationRequest.identityCsrPEM) && + Objects.equals(this.discoveryProfiles, agentRegistrationRequest.discoveryProfiles); + } + + @Override + public int hashCode() { + return Objects.hash(agentDisplayName, agentDescription, version, agentHost, endpoints, serverCsrPEM, + serverCertificatePEM, serverCertificateChainPEM, identityCsrPEM, discoveryProfiles); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentRegistrationRequest {\n"); + sb.append(" agentDisplayName: ").append(toIndentedString(agentDisplayName)).append("\n"); + sb.append(" agentDescription: ").append(toIndentedString(agentDescription)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" agentHost: ").append(toIndentedString(agentHost)).append("\n"); + sb.append(" endpoints: ").append(toIndentedString(endpoints)).append("\n"); + sb.append(" serverCsrPEM: ").append(toIndentedString(serverCsrPEM)).append("\n"); + sb.append(" serverCertificatePEM: ").append(toIndentedString(serverCertificatePEM)).append("\n"); + sb.append(" serverCertificateChainPEM: ").append(toIndentedString(serverCertificateChainPEM)).append("\n"); + sb.append(" identityCsrPEM: ").append(toIndentedString(identityCsrPEM)).append("\n"); + sb.append(" discoveryProfiles: ").append(toIndentedString(discoveryProfiles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationRequest.java new file mode 100644 index 0000000..adb0ee3 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationRequest.java @@ -0,0 +1,114 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentRevocationRequest + */ +@JsonPropertyOrder({ + AgentRevocationRequest.JSON_PROPERTY_REASON, + AgentRevocationRequest.JSON_PROPERTY_COMMENTS +}) +public class AgentRevocationRequest { + public static final String JSON_PROPERTY_REASON = "reason"; + + @Nonnull + private RevocationReason reason; + + public static final String JSON_PROPERTY_COMMENTS = "comments"; + + @Nullable + private String comments; + + public AgentRevocationRequest() { + } + + public AgentRevocationRequest reason(@Nonnull RevocationReason reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RevocationReason getReason() { + return reason; + } + + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReason(@Nonnull RevocationReason reason) { + this.reason = reason; + } + + public AgentRevocationRequest comments(@Nullable String comments) { + this.comments = comments; + return this; + } + + /** + * Get comments + * @return comments + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_COMMENTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getComments() { + return comments; + } + + @JsonProperty(value = JSON_PROPERTY_COMMENTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComments(@Nullable String comments) { + this.comments = comments; + } + + /** + * Return true if this AgentRevocationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentRevocationRequest agentRevocationRequest = (AgentRevocationRequest) o; + return Objects.equals(this.reason, agentRevocationRequest.reason) && + Objects.equals(this.comments, agentRevocationRequest.comments); + } + + @Override + public int hashCode() { + return Objects.hash(reason, comments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentRevocationRequest {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" comments: ").append(toIndentedString(comments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationResponse.java new file mode 100644 index 0000000..c27545f --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentRevocationResponse.java @@ -0,0 +1,285 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * AgentRevocationResponse + */ +@JsonPropertyOrder({ + AgentRevocationResponse.JSON_PROPERTY_AGENT_ID, + AgentRevocationResponse.JSON_PROPERTY_ANS_NAME, + AgentRevocationResponse.JSON_PROPERTY_STATUS, + AgentRevocationResponse.JSON_PROPERTY_REVOKED_AT, + AgentRevocationResponse.JSON_PROPERTY_REASON, + AgentRevocationResponse.JSON_PROPERTY_DNS_RECORDS_TO_REMOVE, + AgentRevocationResponse.JSON_PROPERTY_LINKS +}) +public class AgentRevocationResponse { + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + @Nonnull + private UUID agentId; + + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nonnull + private AgentLifecycleStatus status; + + public static final String JSON_PROPERTY_REVOKED_AT = "revokedAt"; + + @Nonnull + private OffsetDateTime revokedAt; + + public static final String JSON_PROPERTY_REASON = "reason"; + + @Nonnull + private RevocationReason reason; + + public static final String JSON_PROPERTY_DNS_RECORDS_TO_REMOVE = "dnsRecordsToRemove"; + + @Nullable + private List dnsRecordsToRemove = new ArrayList<>(); + + public static final String JSON_PROPERTY_LINKS = "links"; + + @Nonnull + private List links = new ArrayList<>(); + + public AgentRevocationResponse() { + } + + public AgentRevocationResponse agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Get agentId + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public AgentRevocationResponse ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Get ansName + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public AgentRevocationResponse status(@Nonnull AgentLifecycleStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentLifecycleStatus getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull AgentLifecycleStatus status) { + this.status = status; + } + + public AgentRevocationResponse revokedAt(@Nonnull OffsetDateTime revokedAt) { + this.revokedAt = revokedAt; + return this; + } + + /** + * Get revokedAt + * @return revokedAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_REVOKED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getRevokedAt() { + return revokedAt; + } + + @JsonProperty(value = JSON_PROPERTY_REVOKED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRevokedAt(@Nonnull OffsetDateTime revokedAt) { + this.revokedAt = revokedAt; + } + + public AgentRevocationResponse reason(@Nonnull RevocationReason reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RevocationReason getReason() { + return reason; + } + + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReason(@Nonnull RevocationReason reason) { + this.reason = reason; + } + + public AgentRevocationResponse dnsRecordsToRemove(@Nullable List dnsRecordsToRemove) { + this.dnsRecordsToRemove = dnsRecordsToRemove; + return this; + } + + public AgentRevocationResponse addDnsRecordsToRemoveItem(DnsRecord dnsRecordsToRemoveItem) { + if (this.dnsRecordsToRemove == null) { + this.dnsRecordsToRemove = new ArrayList<>(); + } + this.dnsRecordsToRemove.add(dnsRecordsToRemoveItem); + return this; + } + + /** + * Get dnsRecordsToRemove + * @return dnsRecordsToRemove + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DNS_RECORDS_TO_REMOVE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDnsRecordsToRemove() { + return dnsRecordsToRemove; + } + + @JsonProperty(value = JSON_PROPERTY_DNS_RECORDS_TO_REMOVE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDnsRecordsToRemove(@Nullable List dnsRecordsToRemove) { + this.dnsRecordsToRemove = dnsRecordsToRemove; + } + + public AgentRevocationResponse links(@Nonnull List links) { + this.links = links; + return this; + } + + public AgentRevocationResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getLinks() { + return links; + } + + @JsonProperty(value = JSON_PROPERTY_LINKS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLinks(@Nonnull List links) { + this.links = links; + } + + /** + * Return true if this AgentRevocationResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentRevocationResponse agentRevocationResponse = (AgentRevocationResponse) o; + return Objects.equals(this.agentId, agentRevocationResponse.agentId) && + Objects.equals(this.ansName, agentRevocationResponse.ansName) && + Objects.equals(this.status, agentRevocationResponse.status) && + Objects.equals(this.revokedAt, agentRevocationResponse.revokedAt) && + Objects.equals(this.reason, agentRevocationResponse.reason) && + Objects.equals(this.dnsRecordsToRemove, agentRevocationResponse.dnsRecordsToRemove) && + Objects.equals(this.links, agentRevocationResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(agentId, ansName, status, revokedAt, reason, dnsRecordsToRemove, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentRevocationResponse {\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" revokedAt: ").append(toIndentedString(revokedAt)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" dnsRecordsToRemove: ").append(toIndentedString(dnsRecordsToRemove)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentStatus.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentStatus.java new file mode 100644 index 0000000..df4d2b7 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentStatus.java @@ -0,0 +1,326 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * AgentStatus + */ +@JsonPropertyOrder({ + AgentStatus.JSON_PROPERTY_STATUS, + AgentStatus.JSON_PROPERTY_PHASE, + AgentStatus.JSON_PROPERTY_COMPLETED_STEPS, + AgentStatus.JSON_PROPERTY_PENDING_STEPS, + AgentStatus.JSON_PROPERTY_CREATED_AT, + AgentStatus.JSON_PROPERTY_UPDATED_AT, + AgentStatus.JSON_PROPERTY_EXPIRES_AT +}) +public class AgentStatus { + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nullable + private AgentLifecycleStatus status; + + /** + * Gets or Sets phase + */ + public enum PhaseEnum { + INITIALIZATION("INITIALIZATION"), + + DOMAIN_VALIDATION("DOMAIN_VALIDATION"), + + CERTIFICATE_ISSUANCE("CERTIFICATE_ISSUANCE"), + + DNS_PROVISIONING("DNS_PROVISIONING"), + + COMPLETED("COMPLETED"); + + private String value; + + PhaseEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static PhaseEnum fromValue(String value) { + for (PhaseEnum b : PhaseEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_PHASE = "phase"; + + @Nullable + private PhaseEnum phase; + + public static final String JSON_PROPERTY_COMPLETED_STEPS = "completedSteps"; + + @Nullable + private List completedSteps = new ArrayList<>(); + + public static final String JSON_PROPERTY_PENDING_STEPS = "pendingSteps"; + + @Nullable + private List pendingSteps = new ArrayList<>(); + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + + @Nullable + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + + @Nullable + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + @Nullable + private OffsetDateTime expiresAt; + + public AgentStatus() { + } + + public AgentStatus status(@Nullable AgentLifecycleStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AgentLifecycleStatus getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@Nullable AgentLifecycleStatus status) { + this.status = status; + } + + public AgentStatus phase(@Nullable PhaseEnum phase) { + this.phase = phase; + return this; + } + + /** + * Get phase + * @return phase + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PHASE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PhaseEnum getPhase() { + return phase; + } + + @JsonProperty(value = JSON_PROPERTY_PHASE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhase(@Nullable PhaseEnum phase) { + this.phase = phase; + } + + public AgentStatus completedSteps(@Nullable List completedSteps) { + this.completedSteps = completedSteps; + return this; + } + + public AgentStatus addCompletedStepsItem(String completedStepsItem) { + if (this.completedSteps == null) { + this.completedSteps = new ArrayList<>(); + } + this.completedSteps.add(completedStepsItem); + return this; + } + + /** + * Get completedSteps + * @return completedSteps + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_COMPLETED_STEPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCompletedSteps() { + return completedSteps; + } + + @JsonProperty(value = JSON_PROPERTY_COMPLETED_STEPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCompletedSteps(@Nullable List completedSteps) { + this.completedSteps = completedSteps; + } + + public AgentStatus pendingSteps(@Nullable List pendingSteps) { + this.pendingSteps = pendingSteps; + return this; + } + + public AgentStatus addPendingStepsItem(String pendingStepsItem) { + if (this.pendingSteps == null) { + this.pendingSteps = new ArrayList<>(); + } + this.pendingSteps.add(pendingStepsItem); + return this; + } + + /** + * Get pendingSteps + * @return pendingSteps + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PENDING_STEPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPendingSteps() { + return pendingSteps; + } + + @JsonProperty(value = JSON_PROPERTY_PENDING_STEPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPendingSteps(@Nullable List pendingSteps) { + this.pendingSteps = pendingSteps; + } + + public AgentStatus createdAt(@Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(@Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public AgentStatus updatedAt(@Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(@Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public AgentStatus expiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + /** + * Return true if this AgentStatus object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentStatus agentStatus = (AgentStatus) o; + return Objects.equals(this.status, agentStatus.status) && + Objects.equals(this.phase, agentStatus.phase) && + Objects.equals(this.completedSteps, agentStatus.completedSteps) && + Objects.equals(this.pendingSteps, agentStatus.pendingSteps) && + Objects.equals(this.createdAt, agentStatus.createdAt) && + Objects.equals(this.updatedAt, agentStatus.updatedAt) && + Objects.equals(this.expiresAt, agentStatus.expiresAt); + } + + @Override + public int hashCode() { + return Objects.hash(status, phase, completedSteps, pendingSteps, createdAt, updatedAt, expiresAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentStatus {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" phase: ").append(toIndentedString(phase)).append("\n"); + sb.append(" completedSteps: ").append(toIndentedString(completedSteps)).append("\n"); + sb.append(" pendingSteps: ").append(toIndentedString(pendingSteps)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogAttestation.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogAttestation.java new file mode 100644 index 0000000..7541126 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogAttestation.java @@ -0,0 +1,147 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * A verifiable claim (AI Catalog §5.4). The ANS-Registration attestation points at the agent's SCITT receipt on the + * Transparency Log; it carries no digest (the receipt proves inclusion, not entry content). + */ +@JsonPropertyOrder({ + CatalogAttestation.JSON_PROPERTY_TYPE, + CatalogAttestation.JSON_PROPERTY_URI, + CatalogAttestation.JSON_PROPERTY_MEDIA_TYPE +}) +public class CatalogAttestation { + public static final String JSON_PROPERTY_TYPE = "type"; + + @Nonnull + private String type; + + public static final String JSON_PROPERTY_URI = "uri"; + + @Nonnull + private URI uri; + + public static final String JSON_PROPERTY_MEDIA_TYPE = "mediaType"; + + @Nonnull + private String mediaType; + + public CatalogAttestation() { + } + + public CatalogAttestation type(@Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@Nonnull String type) { + this.type = type; + } + + public CatalogAttestation uri(@Nonnull URI uri) { + this.uri = uri; + return this; + } + + /** + * Get uri + * @return uri + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_URI, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public URI getUri() { + return uri; + } + + @JsonProperty(value = JSON_PROPERTY_URI, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUri(@Nonnull URI uri) { + this.uri = uri; + } + + public CatalogAttestation mediaType(@Nonnull String mediaType) { + this.mediaType = mediaType; + return this; + } + + /** + * Get mediaType + * @return mediaType + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_MEDIA_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMediaType() { + return mediaType; + } + + @JsonProperty(value = JSON_PROPERTY_MEDIA_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMediaType(@Nonnull String mediaType) { + this.mediaType = mediaType; + } + + /** + * Return true if this CatalogAttestation object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogAttestation catalogAttestation = (CatalogAttestation) o; + return Objects.equals(this.type, catalogAttestation.type) && + Objects.equals(this.uri, catalogAttestation.uri) && + Objects.equals(this.mediaType, catalogAttestation.mediaType); + } + + @Override + public int hashCode() { + return Objects.hash(type, uri, mediaType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogAttestation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogDocument.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogDocument.java new file mode 100644 index 0000000..297a99a --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogDocument.java @@ -0,0 +1,157 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * A host-complete AI Catalog document (AI Catalog §4.2), served as application/ai-catalog+json. The file an AHP + * publishes at `/.well-known/ai-catalog.json`; `entries` carries one CatalogEntry per ACTIVE, + * catalog-eligible agent on the host (sorted by identifier then version for a stable ETag). + */ +@JsonPropertyOrder({ + CatalogDocument.JSON_PROPERTY_SPEC_VERSION, + CatalogDocument.JSON_PROPERTY_HOST, + CatalogDocument.JSON_PROPERTY_ENTRIES +}) +public class CatalogDocument { + public static final String JSON_PROPERTY_SPEC_VERSION = "specVersion"; + + @Nonnull + private String specVersion; + + public static final String JSON_PROPERTY_HOST = "host"; + + @Nullable + private CatalogHostInfo host; + + public static final String JSON_PROPERTY_ENTRIES = "entries"; + + @Nonnull + private List entries = new ArrayList<>(); + + public CatalogDocument() { + } + + public CatalogDocument specVersion(@Nonnull String specVersion) { + this.specVersion = specVersion; + return this; + } + + /** + * Get specVersion + * @return specVersion + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_SPEC_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSpecVersion() { + return specVersion; + } + + @JsonProperty(value = JSON_PROPERTY_SPEC_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSpecVersion(@Nonnull String specVersion) { + this.specVersion = specVersion; + } + + public CatalogDocument host(@Nullable CatalogHostInfo host) { + this.host = host; + return this; + } + + /** + * Get host + * @return host + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_HOST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CatalogHostInfo getHost() { + return host; + } + + @JsonProperty(value = JSON_PROPERTY_HOST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHost(@Nullable CatalogHostInfo host) { + this.host = host; + } + + public CatalogDocument entries(@Nonnull List entries) { + this.entries = entries; + return this; + } + + public CatalogDocument addEntriesItem(CatalogEntry entriesItem) { + if (this.entries == null) { + this.entries = new ArrayList<>(); + } + this.entries.add(entriesItem); + return this; + } + + /** + * Get entries + * @return entries + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ENTRIES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEntries() { + return entries; + } + + @JsonProperty(value = JSON_PROPERTY_ENTRIES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEntries(@Nonnull List entries) { + this.entries = entries; + } + + /** + * Return true if this CatalogDocument object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogDocument catalogDocument = (CatalogDocument) o; + return Objects.equals(this.specVersion, catalogDocument.specVersion) && + Objects.equals(this.host, catalogDocument.host) && + Objects.equals(this.entries, catalogDocument.entries); + } + + @Override + public int hashCode() { + return Objects.hash(specVersion, host, entries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogDocument {\n"); + sb.append(" specVersion: ").append(toIndentedString(specVersion)).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntry.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntry.java new file mode 100644 index 0000000..4255a27 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntry.java @@ -0,0 +1,439 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * One artifact's AI Catalog record, derived from a registration (AI Catalog draft 2026-06-11 §4.4). A bare entry is + * served as application/json — it is not itself a catalog document and carries no `specVersion`. Exactly one + * of `url` or `data` is present: a single-protocol entry carries `url`; a multi-protocol + * agent carries `data` (an inline nested catalog of per-protocol children) with `mediaType` + * `application/ai-catalog+json`. + */ +@JsonPropertyOrder({ + CatalogEntry.JSON_PROPERTY_IDENTIFIER, + CatalogEntry.JSON_PROPERTY_DISPLAY_NAME, + CatalogEntry.JSON_PROPERTY_DESCRIPTION, + CatalogEntry.JSON_PROPERTY_VERSION, + CatalogEntry.JSON_PROPERTY_MEDIA_TYPE, + CatalogEntry.JSON_PROPERTY_URL, + CatalogEntry.JSON_PROPERTY_DATA, + CatalogEntry.JSON_PROPERTY_TAGS, + CatalogEntry.JSON_PROPERTY_UPDATED_AT, + CatalogEntry.JSON_PROPERTY_PUBLISHER, + CatalogEntry.JSON_PROPERTY_METADATA, + CatalogEntry.JSON_PROPERTY_TRUST_MANIFEST +}) +public class CatalogEntry { + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + + @Nonnull + private String identifier; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + + @Nonnull + private String displayName; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + + @Nullable + private String description; + + public static final String JSON_PROPERTY_VERSION = "version"; + + @Nullable + private String version; + + public static final String JSON_PROPERTY_MEDIA_TYPE = "mediaType"; + + @Nonnull + private String mediaType; + + public static final String JSON_PROPERTY_URL = "url"; + + @Nullable + private URI url; + + public static final String JSON_PROPERTY_DATA = "data"; + + @Nullable + private CatalogNested data; + + public static final String JSON_PROPERTY_TAGS = "tags"; + + @Nullable + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + + @Nullable + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_PUBLISHER = "publisher"; + + @Nullable + private CatalogPublisher publisher; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + + @Nullable + private CatalogEntryMetadata metadata; + + public static final String JSON_PROPERTY_TRUST_MANIFEST = "trustManifest"; + + @Nullable + private CatalogTrustManifest trustManifest; + + public CatalogEntry() { + } + + public CatalogEntry identifier(@Nonnull String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Stable, version-spanning lineage handle `urn:air:{agentHost}:agents:{label}`, where `{label}` + * is the agent's display name with whitespace runs collapsed to single hyphens — the same derivation the ARD + * discovery service (the Finder) mints from feed events, so search results and the published catalog carry one + * identifier per agent. Never the per-version agentId. + * @return identifier + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentifier() { + return identifier; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentifier(@Nonnull String identifier) { + this.identifier = identifier; + } + + public CatalogEntry displayName(@Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * @return displayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDisplayName(@Nonnull String displayName) { + this.displayName = displayName; + } + + public CatalogEntry description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(@Nullable String description) { + this.description = description; + } + + public CatalogEntry version(@Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_VERSION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVersion() { + return version; + } + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVersion(@Nullable String version) { + this.version = version; + } + + public CatalogEntry mediaType(@Nonnull String mediaType) { + this.mediaType = mediaType; + return this; + } + + /** + * Artifact discriminator: `application/a2a-agent-card+json`, + * `application/mcp-server-card+json`, or `application/ai-catalog+json` for a multi-protocol + * nested entry. + * @return mediaType + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_MEDIA_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMediaType() { + return mediaType; + } + + @JsonProperty(value = JSON_PROPERTY_MEDIA_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMediaType(@Nonnull String mediaType) { + this.mediaType = mediaType; + } + + public CatalogEntry url(@Nullable URI url) { + this.url = url; + return this; + } + + /** + * The endpoint's metaDataUrl (the protocol card location). Present on a single-protocol or nested-child entry. + * Mutually exclusive with `data`. + * @return url + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public URI getUrl() { + return url; + } + + @JsonProperty(value = JSON_PROPERTY_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUrl(@Nullable URI url) { + this.url = url; + } + + public CatalogEntry data(@Nullable CatalogNested data) { + this.data = data; + return this; + } + + /** + * Inline nested catalog of per-protocol children, present only on a multi-protocol outer entry. Mutually exclusive + * with `url`. + * @return data + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CatalogNested getData() { + return data; + } + + @JsonProperty(value = JSON_PROPERTY_DATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setData(@Nullable CatalogNested data) { + this.data = data; + } + + public CatalogEntry tags(@Nullable List tags) { + this.tags = tags; + return this; + } + + public CatalogEntry addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@Nullable List tags) { + this.tags = tags; + } + + public CatalogEntry updatedAt(@Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(@Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public CatalogEntry publisher(@Nullable CatalogPublisher publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get publisher + * @return publisher + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PUBLISHER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CatalogPublisher getPublisher() { + return publisher; + } + + @JsonProperty(value = JSON_PROPERTY_PUBLISHER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPublisher(@Nullable CatalogPublisher publisher) { + this.publisher = publisher; + } + + public CatalogEntry metadata(@Nullable CatalogEntryMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_METADATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CatalogEntryMetadata getMetadata() { + return metadata; + } + + @JsonProperty(value = JSON_PROPERTY_METADATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMetadata(@Nullable CatalogEntryMetadata metadata) { + this.metadata = metadata; + } + + public CatalogEntry trustManifest(@Nullable CatalogTrustManifest trustManifest) { + this.trustManifest = trustManifest; + return this; + } + + /** + * Get trustManifest + * @return trustManifest + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TRUST_MANIFEST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CatalogTrustManifest getTrustManifest() { + return trustManifest; + } + + @JsonProperty(value = JSON_PROPERTY_TRUST_MANIFEST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTrustManifest(@Nullable CatalogTrustManifest trustManifest) { + this.trustManifest = trustManifest; + } + + /** + * Return true if this CatalogEntry object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogEntry catalogEntry = (CatalogEntry) o; + return Objects.equals(this.identifier, catalogEntry.identifier) && + Objects.equals(this.displayName, catalogEntry.displayName) && + Objects.equals(this.description, catalogEntry.description) && + Objects.equals(this.version, catalogEntry.version) && + Objects.equals(this.mediaType, catalogEntry.mediaType) && + Objects.equals(this.url, catalogEntry.url) && + Objects.equals(this.data, catalogEntry.data) && + Objects.equals(this.tags, catalogEntry.tags) && + Objects.equals(this.updatedAt, catalogEntry.updatedAt) && + Objects.equals(this.publisher, catalogEntry.publisher) && + Objects.equals(this.metadata, catalogEntry.metadata) && + Objects.equals(this.trustManifest, catalogEntry.trustManifest); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, displayName, description, version, mediaType, url, data, tags, updatedAt, + publisher, metadata, trustManifest); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogEntry {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" publisher: ").append(toIndentedString(publisher)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" trustManifest: ").append(toIndentedString(trustManifest)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntryMetadata.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntryMetadata.java new file mode 100644 index 0000000..122ebec --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogEntryMetadata.java @@ -0,0 +1,149 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Entry-level identifiers a consumer verifies against (IMPL §5.3). No `logId` — the TL is keyed by agentId, + * not logId. + */ +@JsonPropertyOrder({ + CatalogEntryMetadata.JSON_PROPERTY_ANS_NAME, + CatalogEntryMetadata.JSON_PROPERTY_AGENT_HOST, + CatalogEntryMetadata.JSON_PROPERTY_BADGE_URL +}) +public class CatalogEntryMetadata { + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_AGENT_HOST = "agentHost"; + + @Nonnull + private String agentHost; + + public static final String JSON_PROPERTY_BADGE_URL = "badgeUrl"; + + @Nullable + private URI badgeUrl; + + public CatalogEntryMetadata() { + } + + public CatalogEntryMetadata ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Get ansName + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public CatalogEntryMetadata agentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + return this; + } + + /** + * Get agentHost + * @return agentHost + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentHost() { + return agentHost; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + } + + public CatalogEntryMetadata badgeUrl(@Nullable URI badgeUrl) { + this.badgeUrl = badgeUrl; + return this; + } + + /** + * TL status / card-integrity surface (`<tl>/v1/agents/{agentId}`). Omitted when no TL base URL is + * configured. + * @return badgeUrl + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_BADGE_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public URI getBadgeUrl() { + return badgeUrl; + } + + @JsonProperty(value = JSON_PROPERTY_BADGE_URL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBadgeUrl(@Nullable URI badgeUrl) { + this.badgeUrl = badgeUrl; + } + + /** + * Return true if this CatalogEntryMetadata object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogEntryMetadata catalogEntryMetadata = (CatalogEntryMetadata) o; + return Objects.equals(this.ansName, catalogEntryMetadata.ansName) && + Objects.equals(this.agentHost, catalogEntryMetadata.agentHost) && + Objects.equals(this.badgeUrl, catalogEntryMetadata.badgeUrl); + } + + @Override + public int hashCode() { + return Objects.hash(ansName, agentHost, badgeUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogEntryMetadata {\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" agentHost: ").append(toIndentedString(agentHost)).append("\n"); + sb.append(" badgeUrl: ").append(toIndentedString(badgeUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogHostInfo.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogHostInfo.java new file mode 100644 index 0000000..749cf08 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogHostInfo.java @@ -0,0 +1,115 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Host Info object (AI Catalog §4.3) identifying the operator of a catalog document. `displayName` is + * required within Host Info; for a per-host document both fields are the agentHost. + */ +@JsonPropertyOrder({ + CatalogHostInfo.JSON_PROPERTY_IDENTIFIER, + CatalogHostInfo.JSON_PROPERTY_DISPLAY_NAME +}) +public class CatalogHostInfo { + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + + @Nullable + private String identifier; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + + @Nonnull + private String displayName; + + public CatalogHostInfo() { + } + + public CatalogHostInfo identifier(@Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIdentifier() { + return identifier; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIdentifier(@Nullable String identifier) { + this.identifier = identifier; + } + + public CatalogHostInfo displayName(@Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * @return displayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDisplayName(@Nonnull String displayName) { + this.displayName = displayName; + } + + /** + * Return true if this CatalogHostInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogHostInfo catalogHostInfo = (CatalogHostInfo) o; + return Objects.equals(this.identifier, catalogHostInfo.identifier) && + Objects.equals(this.displayName, catalogHostInfo.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, displayName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogHostInfo {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogNested.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogNested.java new file mode 100644 index 0000000..d23b7b6 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogNested.java @@ -0,0 +1,124 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * Inline nested catalog held in a multi-protocol entry's `data` (AI Catalog §6.1 / IMPL §3.5). + */ +@JsonPropertyOrder({ + CatalogNested.JSON_PROPERTY_SPEC_VERSION, + CatalogNested.JSON_PROPERTY_ENTRIES +}) +public class CatalogNested { + public static final String JSON_PROPERTY_SPEC_VERSION = "specVersion"; + + @Nonnull + private String specVersion; + + public static final String JSON_PROPERTY_ENTRIES = "entries"; + + @Nonnull + private List entries = new ArrayList<>(); + + public CatalogNested() { + } + + public CatalogNested specVersion(@Nonnull String specVersion) { + this.specVersion = specVersion; + return this; + } + + /** + * Get specVersion + * @return specVersion + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_SPEC_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSpecVersion() { + return specVersion; + } + + @JsonProperty(value = JSON_PROPERTY_SPEC_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSpecVersion(@Nonnull String specVersion) { + this.specVersion = specVersion; + } + + public CatalogNested entries(@Nonnull List entries) { + this.entries = entries; + return this; + } + + public CatalogNested addEntriesItem(CatalogEntry entriesItem) { + if (this.entries == null) { + this.entries = new ArrayList<>(); + } + this.entries.add(entriesItem); + return this; + } + + /** + * Get entries + * @return entries + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ENTRIES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEntries() { + return entries; + } + + @JsonProperty(value = JSON_PROPERTY_ENTRIES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEntries(@Nonnull List entries) { + this.entries = entries; + } + + /** + * Return true if this CatalogNested object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogNested catalogNested = (CatalogNested) o; + return Objects.equals(this.specVersion, catalogNested.specVersion) && + Objects.equals(this.entries, catalogNested.entries); + } + + @Override + public int hashCode() { + return Objects.hash(specVersion, entries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogNested {\n"); + sb.append(" specVersion: ").append(toIndentedString(specVersion)).append("\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogPublisher.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogPublisher.java new file mode 100644 index 0000000..ce0b6c4 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogPublisher.java @@ -0,0 +1,145 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Publishing entity (AI Catalog §4.6). DNS-anchored in this RA; `identifier` and `displayName` are + * both the agentHost. + */ +@JsonPropertyOrder({ + CatalogPublisher.JSON_PROPERTY_IDENTIFIER, + CatalogPublisher.JSON_PROPERTY_DISPLAY_NAME, + CatalogPublisher.JSON_PROPERTY_IDENTITY_TYPE +}) +public class CatalogPublisher { + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + + @Nonnull + private String identifier; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + + @Nonnull + private String displayName; + + public static final String JSON_PROPERTY_IDENTITY_TYPE = "identityType"; + + @Nullable + private String identityType; + + public CatalogPublisher() { + } + + public CatalogPublisher identifier(@Nonnull String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentifier() { + return identifier; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTIFIER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentifier(@Nonnull String identifier) { + this.identifier = identifier; + } + + public CatalogPublisher displayName(@Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * @return displayName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDisplayName(@Nonnull String displayName) { + this.displayName = displayName; + } + + public CatalogPublisher identityType(@Nullable String identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get identityType + * @return identityType + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_IDENTITY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIdentityType() { + return identityType; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIdentityType(@Nullable String identityType) { + this.identityType = identityType; + } + + /** + * Return true if this CatalogPublisher object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogPublisher catalogPublisher = (CatalogPublisher) o; + return Objects.equals(this.identifier, catalogPublisher.identifier) && + Objects.equals(this.displayName, catalogPublisher.displayName) && + Objects.equals(this.identityType, catalogPublisher.identityType); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, displayName, identityType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogPublisher {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" identityType: ").append(toIndentedString(identityType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogTrustManifest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogTrustManifest.java new file mode 100644 index 0000000..18474e7 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CatalogTrustManifest.java @@ -0,0 +1,126 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Verifiable identity + trust metadata (AI Catalog §5). `identity` MUST equal the containing entry's + * `identifier`. + */ +@JsonPropertyOrder({ + CatalogTrustManifest.JSON_PROPERTY_IDENTITY, + CatalogTrustManifest.JSON_PROPERTY_ATTESTATIONS +}) +public class CatalogTrustManifest { + public static final String JSON_PROPERTY_IDENTITY = "identity"; + + @Nonnull + private String identity; + + public static final String JSON_PROPERTY_ATTESTATIONS = "attestations"; + + @Nullable + private List attestations = new ArrayList<>(); + + public CatalogTrustManifest() { + } + + public CatalogTrustManifest identity(@Nonnull String identity) { + this.identity = identity; + return this; + } + + /** + * Get identity + * @return identity + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTITY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentity() { + return identity; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentity(@Nonnull String identity) { + this.identity = identity; + } + + public CatalogTrustManifest attestations(@Nullable List attestations) { + this.attestations = attestations; + return this; + } + + public CatalogTrustManifest addAttestationsItem(CatalogAttestation attestationsItem) { + if (this.attestations == null) { + this.attestations = new ArrayList<>(); + } + this.attestations.add(attestationsItem); + return this; + } + + /** + * Present only when a TL base URL is configured. The slice-1 attestation is the ANS-Registration SCITT receipt. + * @return attestations + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_ATTESTATIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAttestations() { + return attestations; + } + + @JsonProperty(value = JSON_PROPERTY_ATTESTATIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttestations(@Nullable List attestations) { + this.attestations = attestations; + } + + /** + * Return true if this CatalogTrustManifest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatalogTrustManifest catalogTrustManifest = (CatalogTrustManifest) o; + return Objects.equals(this.identity, catalogTrustManifest.identity) && + Objects.equals(this.attestations, catalogTrustManifest.attestations); + } + + @Override + public int hashCode() { + return Objects.hash(identity, attestations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatalogTrustManifest {\n"); + sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); + sb.append(" attestations: ").append(toIndentedString(attestations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CertificateResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CertificateResponse.java new file mode 100644 index 0000000..425afbb --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CertificateResponse.java @@ -0,0 +1,361 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * CertificateResponse + */ +@JsonPropertyOrder({ + CertificateResponse.JSON_PROPERTY_CSR_ID, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_SUBJECT, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_ISSUER, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_SERIAL_NUMBER, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_VALID_FROM, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_VALID_TO, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_P_E_M, + CertificateResponse.JSON_PROPERTY_CHAIN_P_E_M, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_PUBLIC_KEY_ALGORITHM, + CertificateResponse.JSON_PROPERTY_CERTIFICATE_SIGNATURE_ALGORITHM +}) +public class CertificateResponse { + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + + @Nonnull + private UUID csrId; + + public static final String JSON_PROPERTY_CERTIFICATE_SUBJECT = "certificateSubject"; + + @Nullable + private String certificateSubject; + + public static final String JSON_PROPERTY_CERTIFICATE_ISSUER = "certificateIssuer"; + + @Nullable + private String certificateIssuer; + + public static final String JSON_PROPERTY_CERTIFICATE_SERIAL_NUMBER = "certificateSerialNumber"; + + @Nullable + private String certificateSerialNumber; + + public static final String JSON_PROPERTY_CERTIFICATE_VALID_FROM = "certificateValidFrom"; + + @Nonnull + private OffsetDateTime certificateValidFrom; + + public static final String JSON_PROPERTY_CERTIFICATE_VALID_TO = "certificateValidTo"; + + @Nonnull + private OffsetDateTime certificateValidTo; + + public static final String JSON_PROPERTY_CERTIFICATE_P_E_M = "certificatePEM"; + + @Nonnull + private String certificatePEM; + + public static final String JSON_PROPERTY_CHAIN_P_E_M = "chainPEM"; + + @Nullable + private String chainPEM; + + public static final String JSON_PROPERTY_CERTIFICATE_PUBLIC_KEY_ALGORITHM = "certificatePublicKeyAlgorithm"; + + @Nullable + private String certificatePublicKeyAlgorithm; + + public static final String JSON_PROPERTY_CERTIFICATE_SIGNATURE_ALGORITHM = "certificateSignatureAlgorithm"; + + @Nullable + private String certificateSignatureAlgorithm; + + public CertificateResponse() { + } + + public CertificateResponse csrId(@Nonnull UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCsrId(@Nonnull UUID csrId) { + this.csrId = csrId; + } + + public CertificateResponse certificateSubject(@Nullable String certificateSubject) { + this.certificateSubject = certificateSubject; + return this; + } + + /** + * Get certificateSubject + * @return certificateSubject + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SUBJECT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificateSubject() { + return certificateSubject; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SUBJECT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCertificateSubject(@Nullable String certificateSubject) { + this.certificateSubject = certificateSubject; + } + + public CertificateResponse certificateIssuer(@Nullable String certificateIssuer) { + this.certificateIssuer = certificateIssuer; + return this; + } + + /** + * Get certificateIssuer + * @return certificateIssuer + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_ISSUER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificateIssuer() { + return certificateIssuer; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_ISSUER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCertificateIssuer(@Nullable String certificateIssuer) { + this.certificateIssuer = certificateIssuer; + } + + public CertificateResponse certificateSerialNumber(@Nullable String certificateSerialNumber) { + this.certificateSerialNumber = certificateSerialNumber; + return this; + } + + /** + * Get certificateSerialNumber + * @return certificateSerialNumber + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SERIAL_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificateSerialNumber() { + return certificateSerialNumber; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SERIAL_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCertificateSerialNumber(@Nullable String certificateSerialNumber) { + this.certificateSerialNumber = certificateSerialNumber; + } + + public CertificateResponse certificateValidFrom(@Nonnull OffsetDateTime certificateValidFrom) { + this.certificateValidFrom = certificateValidFrom; + return this; + } + + /** + * Get certificateValidFrom + * @return certificateValidFrom + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_VALID_FROM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCertificateValidFrom() { + return certificateValidFrom; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_VALID_FROM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCertificateValidFrom(@Nonnull OffsetDateTime certificateValidFrom) { + this.certificateValidFrom = certificateValidFrom; + } + + public CertificateResponse certificateValidTo(@Nonnull OffsetDateTime certificateValidTo) { + this.certificateValidTo = certificateValidTo; + return this; + } + + /** + * Get certificateValidTo + * @return certificateValidTo + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_VALID_TO, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCertificateValidTo() { + return certificateValidTo; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_VALID_TO, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCertificateValidTo(@Nonnull OffsetDateTime certificateValidTo) { + this.certificateValidTo = certificateValidTo; + } + + public CertificateResponse certificatePEM(@Nonnull String certificatePEM) { + this.certificatePEM = certificatePEM; + return this; + } + + /** + * Get certificatePEM + * @return certificatePEM + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_P_E_M, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCertificatePEM() { + return certificatePEM; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_P_E_M, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCertificatePEM(@Nonnull String certificatePEM) { + this.certificatePEM = certificatePEM; + } + + public CertificateResponse chainPEM(@Nullable String chainPEM) { + this.chainPEM = chainPEM; + return this; + } + + /** + * Get chainPEM + * @return chainPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getChainPEM() { + return chainPEM; + } + + @JsonProperty(value = JSON_PROPERTY_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChainPEM(@Nullable String chainPEM) { + this.chainPEM = chainPEM; + } + + public CertificateResponse certificatePublicKeyAlgorithm(@Nullable String certificatePublicKeyAlgorithm) { + this.certificatePublicKeyAlgorithm = certificatePublicKeyAlgorithm; + return this; + } + + /** + * Get certificatePublicKeyAlgorithm + * @return certificatePublicKeyAlgorithm + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_PUBLIC_KEY_ALGORITHM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificatePublicKeyAlgorithm() { + return certificatePublicKeyAlgorithm; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_PUBLIC_KEY_ALGORITHM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCertificatePublicKeyAlgorithm(@Nullable String certificatePublicKeyAlgorithm) { + this.certificatePublicKeyAlgorithm = certificatePublicKeyAlgorithm; + } + + public CertificateResponse certificateSignatureAlgorithm(@Nullable String certificateSignatureAlgorithm) { + this.certificateSignatureAlgorithm = certificateSignatureAlgorithm; + return this; + } + + /** + * Get certificateSignatureAlgorithm + * @return certificateSignatureAlgorithm + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SIGNATURE_ALGORITHM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificateSignatureAlgorithm() { + return certificateSignatureAlgorithm; + } + + @JsonProperty(value = JSON_PROPERTY_CERTIFICATE_SIGNATURE_ALGORITHM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCertificateSignatureAlgorithm(@Nullable String certificateSignatureAlgorithm) { + this.certificateSignatureAlgorithm = certificateSignatureAlgorithm; + } + + /** + * Return true if this CertificateResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CertificateResponse certificateResponse = (CertificateResponse) o; + return Objects.equals(this.csrId, certificateResponse.csrId) && + Objects.equals(this.certificateSubject, certificateResponse.certificateSubject) && + Objects.equals(this.certificateIssuer, certificateResponse.certificateIssuer) && + Objects.equals(this.certificateSerialNumber, certificateResponse.certificateSerialNumber) && + Objects.equals(this.certificateValidFrom, certificateResponse.certificateValidFrom) && + Objects.equals(this.certificateValidTo, certificateResponse.certificateValidTo) && + Objects.equals(this.certificatePEM, certificateResponse.certificatePEM) && + Objects.equals(this.chainPEM, certificateResponse.chainPEM) && + Objects.equals(this.certificatePublicKeyAlgorithm, certificateResponse.certificatePublicKeyAlgorithm) && + Objects.equals(this.certificateSignatureAlgorithm, certificateResponse.certificateSignatureAlgorithm); + } + + @Override + public int hashCode() { + return Objects.hash(csrId, certificateSubject, certificateIssuer, certificateSerialNumber, certificateValidFrom, + certificateValidTo, certificatePEM, chainPEM, certificatePublicKeyAlgorithm, + certificateSignatureAlgorithm); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CertificateResponse {\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" certificateSubject: ").append(toIndentedString(certificateSubject)).append("\n"); + sb.append(" certificateIssuer: ").append(toIndentedString(certificateIssuer)).append("\n"); + sb.append(" certificateSerialNumber: ").append(toIndentedString(certificateSerialNumber)).append("\n"); + sb.append(" certificateValidFrom: ").append(toIndentedString(certificateValidFrom)).append("\n"); + sb.append(" certificateValidTo: ").append(toIndentedString(certificateValidTo)).append("\n"); + sb.append(" certificatePEM: ").append(toIndentedString(certificatePEM)).append("\n"); + sb.append(" chainPEM: ").append(toIndentedString(chainPEM)).append("\n"); + sb.append(" certificatePublicKeyAlgorithm: ").append(toIndentedString(certificatePublicKeyAlgorithm)) + .append("\n"); + sb.append(" certificateSignatureAlgorithm: ").append(toIndentedString(certificateSignatureAlgorithm)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfo.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfo.java new file mode 100644 index 0000000..603bcf8 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfo.java @@ -0,0 +1,273 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * ChallengeInfo + */ +@JsonPropertyOrder({ + ChallengeInfo.JSON_PROPERTY_TYPE, + ChallengeInfo.JSON_PROPERTY_TOKEN, + ChallengeInfo.JSON_PROPERTY_KEY_AUTHORIZATION, + ChallengeInfo.JSON_PROPERTY_DNS_RECORD, + ChallengeInfo.JSON_PROPERTY_HTTP_PATH, + ChallengeInfo.JSON_PROPERTY_EXPIRES_AT +}) +public class ChallengeInfo { + /** + * Gets or Sets type + */ + public enum TypeEnum { + DNS_01("DNS_01"), + + HTTP_01("HTTP_01"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + + @Nullable + private TypeEnum type; + + public static final String JSON_PROPERTY_TOKEN = "token"; + + @Nullable + private String token; + + public static final String JSON_PROPERTY_KEY_AUTHORIZATION = "keyAuthorization"; + + @Nullable + private String keyAuthorization; + + public static final String JSON_PROPERTY_DNS_RECORD = "dnsRecord"; + + @Nullable + private ChallengeInfoDnsRecord dnsRecord; + + public static final String JSON_PROPERTY_HTTP_PATH = "httpPath"; + + @Nullable + private String httpPath; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + @Nullable + private OffsetDateTime expiresAt; + + public ChallengeInfo() { + } + + public ChallengeInfo type(@Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@Nullable TypeEnum type) { + this.type = type; + } + + public ChallengeInfo token(@Nullable String token) { + this.token = token; + return this; + } + + /** + * Get token + * @return token + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TOKEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getToken() { + return token; + } + + @JsonProperty(value = JSON_PROPERTY_TOKEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setToken(@Nullable String token) { + this.token = token; + } + + public ChallengeInfo keyAuthorization(@Nullable String keyAuthorization) { + this.keyAuthorization = keyAuthorization; + return this; + } + + /** + * Get keyAuthorization + * @return keyAuthorization + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_KEY_AUTHORIZATION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getKeyAuthorization() { + return keyAuthorization; + } + + @JsonProperty(value = JSON_PROPERTY_KEY_AUTHORIZATION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setKeyAuthorization(@Nullable String keyAuthorization) { + this.keyAuthorization = keyAuthorization; + } + + public ChallengeInfo dnsRecord(@Nullable ChallengeInfoDnsRecord dnsRecord) { + this.dnsRecord = dnsRecord; + return this; + } + + /** + * Get dnsRecord + * @return dnsRecord + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChallengeInfoDnsRecord getDnsRecord() { + return dnsRecord; + } + + @JsonProperty(value = JSON_PROPERTY_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDnsRecord(@Nullable ChallengeInfoDnsRecord dnsRecord) { + this.dnsRecord = dnsRecord; + } + + public ChallengeInfo httpPath(@Nullable String httpPath) { + this.httpPath = httpPath; + return this; + } + + /** + * Get httpPath + * @return httpPath + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_HTTP_PATH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHttpPath() { + return httpPath; + } + + @JsonProperty(value = JSON_PROPERTY_HTTP_PATH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHttpPath(@Nullable String httpPath) { + this.httpPath = httpPath; + } + + public ChallengeInfo expiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + /** + * Return true if this ChallengeInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChallengeInfo challengeInfo = (ChallengeInfo) o; + return Objects.equals(this.type, challengeInfo.type) && + Objects.equals(this.token, challengeInfo.token) && + Objects.equals(this.keyAuthorization, challengeInfo.keyAuthorization) && + Objects.equals(this.dnsRecord, challengeInfo.dnsRecord) && + Objects.equals(this.httpPath, challengeInfo.httpPath) && + Objects.equals(this.expiresAt, challengeInfo.expiresAt); + } + + @Override + public int hashCode() { + return Objects.hash(type, token, keyAuthorization, dnsRecord, httpPath, expiresAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChallengeInfo {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" keyAuthorization: ").append(toIndentedString(keyAuthorization)).append("\n"); + sb.append(" dnsRecord: ").append(toIndentedString(dnsRecord)).append("\n"); + sb.append(" httpPath: ").append(toIndentedString(httpPath)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecord.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecord.java new file mode 100644 index 0000000..c9ae12a --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecord.java @@ -0,0 +1,143 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * ChallengeInfoDnsRecord + */ +@JsonPropertyOrder({ + ChallengeInfoDnsRecord.JSON_PROPERTY_NAME, + ChallengeInfoDnsRecord.JSON_PROPERTY_TYPE, + ChallengeInfoDnsRecord.JSON_PROPERTY_VALUE +}) +public class ChallengeInfoDnsRecord { + public static final String JSON_PROPERTY_NAME = "name"; + + @Nullable + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + + @Nullable + private String type; + + public static final String JSON_PROPERTY_VALUE = "value"; + + @Nullable + private String value; + + public ChallengeInfoDnsRecord() { + } + + public ChallengeInfoDnsRecord name(@Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@Nullable String name) { + this.name = name; + } + + public ChallengeInfoDnsRecord type(@Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@Nullable String type) { + this.type = type; + } + + public ChallengeInfoDnsRecord value(@Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setValue(@Nullable String value) { + this.value = value; + } + + /** + * Return true if this ChallengeInfo_dnsRecord object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChallengeInfoDnsRecord challengeInfoDnsRecord = (ChallengeInfoDnsRecord) o; + return Objects.equals(this.name, challengeInfoDnsRecord.name) && + Objects.equals(this.type, challengeInfoDnsRecord.type) && + Objects.equals(this.value, challengeInfoDnsRecord.value); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChallengeInfoDnsRecord {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrStatusResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrStatusResponse.java new file mode 100644 index 0000000..e502137 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrStatusResponse.java @@ -0,0 +1,310 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * CsrStatusResponse + */ +@JsonPropertyOrder({ + CsrStatusResponse.JSON_PROPERTY_CSR_ID, + CsrStatusResponse.JSON_PROPERTY_TYPE, + CsrStatusResponse.JSON_PROPERTY_STATUS, + CsrStatusResponse.JSON_PROPERTY_SUBMITTED_AT, + CsrStatusResponse.JSON_PROPERTY_UPDATED_AT, + CsrStatusResponse.JSON_PROPERTY_FAILURE_REASON +}) +public class CsrStatusResponse { + + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + @Nonnull + private UUID csrId; + + /** + * Gets or Sets type + */ + public enum TypeEnum { + SERVER("SERVER"), + + IDENTITY("IDENTITY"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + + @Nonnull + private TypeEnum type; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING("PENDING"), + + SIGNED("SIGNED"), + + REJECTED("REJECTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_SUBMITTED_AT = "submittedAt"; + + @Nonnull + private OffsetDateTime submittedAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + + @Nonnull + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_FAILURE_REASON = "failureReason"; + + @Nullable + private String failureReason; + + public CsrStatusResponse() { + } + + public CsrStatusResponse csrId(@Nonnull UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCsrId(@Nonnull UUID csrId) { + this.csrId = csrId; + } + + public CsrStatusResponse type(@Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@Nonnull TypeEnum type) { + this.type = type; + } + + public CsrStatusResponse status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public CsrStatusResponse submittedAt(@Nonnull OffsetDateTime submittedAt) { + this.submittedAt = submittedAt; + return this; + } + + /** + * Get submittedAt + * @return submittedAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_SUBMITTED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getSubmittedAt() { + return submittedAt; + } + + @JsonProperty(value = JSON_PROPERTY_SUBMITTED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSubmittedAt(@Nonnull OffsetDateTime submittedAt) { + this.submittedAt = submittedAt; + } + + public CsrStatusResponse updatedAt(@Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(value = JSON_PROPERTY_UPDATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUpdatedAt(@Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public CsrStatusResponse failureReason(@Nullable String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Get failureReason + * @return failureReason + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_FAILURE_REASON, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFailureReason() { + return failureReason; + } + + @JsonProperty(value = JSON_PROPERTY_FAILURE_REASON, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFailureReason(@Nullable String failureReason) { + this.failureReason = failureReason; + } + + /** + * Return true if this CsrStatusResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CsrStatusResponse csrStatusResponse = (CsrStatusResponse) o; + return Objects.equals(this.csrId, csrStatusResponse.csrId) && + Objects.equals(this.type, csrStatusResponse.type) && + Objects.equals(this.status, csrStatusResponse.status) && + Objects.equals(this.submittedAt, csrStatusResponse.submittedAt) && + Objects.equals(this.updatedAt, csrStatusResponse.updatedAt) && + Objects.equals(this.failureReason, csrStatusResponse.failureReason); + } + + @Override + public int hashCode() { + return Objects.hash(csrId, type, status, submittedAt, updatedAt, failureReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CsrStatusResponse {\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" submittedAt: ").append(toIndentedString(submittedAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" failureReason: ").append(toIndentedString(failureReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionRequest.java new file mode 100644 index 0000000..2499ab9 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionRequest.java @@ -0,0 +1,83 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * CsrSubmissionRequest + */ +@JsonPropertyOrder({ + CsrSubmissionRequest.JSON_PROPERTY_CSR_P_E_M +}) +public class CsrSubmissionRequest { + public static final String JSON_PROPERTY_CSR_P_E_M = "csrPEM"; + + @Nonnull + private String csrPEM; + + public CsrSubmissionRequest() { + } + + public CsrSubmissionRequest csrPEM(@Nonnull String csrPEM) { + this.csrPEM = csrPEM; + return this; + } + + /** + * Get csrPEM + * @return csrPEM + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CSR_P_E_M, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCsrPEM() { + return csrPEM; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_P_E_M, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCsrPEM(@Nonnull String csrPEM) { + this.csrPEM = csrPEM; + } + + /** + * Return true if this CsrSubmissionRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CsrSubmissionRequest csrSubmissionRequest = (CsrSubmissionRequest) o; + return Objects.equals(this.csrPEM, csrSubmissionRequest.csrPEM); + } + + @Override + public int hashCode() { + return Objects.hash(csrPEM); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CsrSubmissionRequest {\n"); + sb.append(" csrPEM: ").append(toIndentedString(csrPEM)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionResponse.java new file mode 100644 index 0000000..8364d22 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/CsrSubmissionResponse.java @@ -0,0 +1,116 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * CsrSubmissionResponse + */ +@JsonPropertyOrder({ + CsrSubmissionResponse.JSON_PROPERTY_CSR_ID, + CsrSubmissionResponse.JSON_PROPERTY_MESSAGE +}) +public class CsrSubmissionResponse { + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + + @Nonnull + private UUID csrId; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + + @Nullable + private String message; + + public CsrSubmissionResponse() { + } + + public CsrSubmissionResponse csrId(@Nonnull UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCsrId(@Nonnull UUID csrId) { + this.csrId = csrId; + } + + public CsrSubmissionResponse message(@Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@Nullable String message) { + this.message = message; + } + + /** + * Return true if this CsrSubmissionResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CsrSubmissionResponse csrSubmissionResponse = (CsrSubmissionResponse) o; + return Objects.equals(this.csrId, csrSubmissionResponse.csrId) && + Objects.equals(this.message, csrSubmissionResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(csrId, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CsrSubmissionResponse {\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DiscoveryProfile.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DiscoveryProfile.java new file mode 100644 index 0000000..5f74d7d --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DiscoveryProfile.java @@ -0,0 +1,41 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Names one DNS record family the RA can emit for an agent registration. Used as the element type of discoveryProfiles[]. Each value provisions a complete record set, not a single record — the bullets below enumerate exactly what an operator must publish for that profile. - ANS_DNSAID: the DNS-AID-aligned Consolidated Approach (RFC 9460), and the server default when discoveryProfiles is omitted. Provisions: 1. One SVCB row per protocol endpoint at the bare FQDN (ServiceMode `1 .`), carrying `alpn` (the protocol token: a2a / mcp / x-http), `port` (the endpoint's TLS port), `key65402` (bap, the agent protocol, always present), and — when the endpoint supplies them — `key65400` (cap, the metadataUrl capability locator), `key65401` (cap-sha256, the base64url capability digest, present only when the endpoint declared a metaDataHash), and `key65409` (the well-known path suffix, emitted only when metadataUrl sits at https://{fqdn}/.well-known/<suffix>). key65400/key65401/key65402/key65409 are the RFC 9460 §14.3.1 Private Use presentation of the DNS-AID draft-02 cap / cap-sha256 / bap / well-known SvcParams, which have no IANA code point yet; the named forms are unpublishable (strict RFC 9460 parsers reject them), so the keyNNNNN forms are what reaches DNS. They switch back to named forms if/when IANA registers the keys. 2. One `_ans-badge` TXT at `_ans-badge.{fqdn}` (the transparency-log discovery hint). 3. One TLSA per distinct TLS port at `_<port>._tcp.{fqdn}` binding the server certificate (DANE-EE, full cert, SHA-256), emitted only when a server certificate exists. - ANS_TXT: original `_ans` TXT shape (one row per protocol at `_ans.{fqdn}`), supported indefinitely for operators with existing zone-edit tooling that targets `_ans.{fqdn}`; opt-in via an explicit discoveryProfiles value. Emits an HTTPS RR at the bare FQDN alongside carrying only `alpn=h2` (an IANA-registered SvcParam — no keyNNNNN form is needed here; the asymmetry with ANS_DNSAID is intentional), since `_ans` TXT carries no connection hints. The HTTPS RR is best-effort: operators on CNAME-fronted apexes cannot publish a record at that name (RFC 1034 §3.6.2) and verification does not require it. Provisions the same `_ans-badge` TXT and per-port TLSA records as ANS_DNSAID. + */ +public enum DiscoveryProfile { + + ANS_DNSAID("ANS_DNSAID"), + + ANS_TXT("ANS_TXT"); + + private String value; + + DiscoveryProfile(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static DiscoveryProfile fromValue(String value) { + for (DiscoveryProfile b : DiscoveryProfile.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsRecord.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsRecord.java new file mode 100644 index 0000000..de9c116 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsRecord.java @@ -0,0 +1,347 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * DnsRecord + */ +@JsonPropertyOrder({ + DnsRecord.JSON_PROPERTY_NAME, + DnsRecord.JSON_PROPERTY_TYPE, + DnsRecord.JSON_PROPERTY_VALUE, + DnsRecord.JSON_PROPERTY_PRIORITY, + DnsRecord.JSON_PROPERTY_TTL, + DnsRecord.JSON_PROPERTY_PURPOSE, + DnsRecord.JSON_PROPERTY_REQUIRED +}) +public class DnsRecord { + public static final String JSON_PROPERTY_NAME = "name"; + + + @Nonnull + private String name; + + /** + * Gets or Sets type + */ + public enum TypeEnum { + HTTPS("HTTPS"), + + SVCB("SVCB"), + + TLSA("TLSA"), + + TXT("TXT"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + + + @Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + + + @Nonnull + private String value; + + public static final String JSON_PROPERTY_PRIORITY = "priority"; + + @Nullable + private Integer priority; + + public static final String JSON_PROPERTY_TTL = "ttl"; + + @Nullable + private Integer ttl = 3600; + + /** + * Gets or Sets purpose + */ + public enum PurposeEnum { + DISCOVERY("DISCOVERY"), + + TRUST("TRUST"), + + CERTIFICATE_BINDING("CERTIFICATE_BINDING"), + + BADGE("BADGE"); + + private String value; + + PurposeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static PurposeEnum fromValue(String value) { + for (PurposeEnum b : PurposeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_PURPOSE = "purpose"; + + @Nullable + private PurposeEnum purpose; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + + @Nullable + private Boolean required = true; + + public DnsRecord() { + } + + public DnsRecord name(@Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@Nonnull String name) { + this.name = name; + } + + public DnsRecord type(@Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@Nonnull TypeEnum type) { + this.type = type; + } + + public DnsRecord value(@Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@Nonnull String value) { + this.value = value; + } + + public DnsRecord priority(@Nullable Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PRIORITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getPriority() { + return priority; + } + + @JsonProperty(value = JSON_PROPERTY_PRIORITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPriority(@Nullable Integer priority) { + this.priority = priority; + } + + public DnsRecord ttl(@Nullable Integer ttl) { + this.ttl = ttl; + return this; + } + + /** + * Get ttl + * @return ttl + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TTL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getTtl() { + return ttl; + } + + @JsonProperty(value = JSON_PROPERTY_TTL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTtl(@Nullable Integer ttl) { + this.ttl = ttl; + } + + public DnsRecord purpose(@Nullable PurposeEnum purpose) { + this.purpose = purpose; + return this; + } + + /** + * Get purpose + * @return purpose + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PURPOSE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PurposeEnum getPurpose() { + return purpose; + } + + @JsonProperty(value = JSON_PROPERTY_PURPOSE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPurpose(@Nullable PurposeEnum purpose) { + this.purpose = purpose; + } + + public DnsRecord required(@Nullable Boolean required) { + this.required = required; + return this; + } + + /** + * Get required + * @return required + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getRequired() { + return required; + } + + @JsonProperty(value = JSON_PROPERTY_REQUIRED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRequired(@Nullable Boolean required) { + this.required = required; + } + + /** + * Return true if this DnsRecord object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DnsRecord dnsRecord = (DnsRecord) o; + return Objects.equals(this.name, dnsRecord.name) && + Objects.equals(this.type, dnsRecord.type) && + Objects.equals(this.value, dnsRecord.value) && + Objects.equals(this.priority, dnsRecord.priority) && + Objects.equals(this.ttl, dnsRecord.ttl) && + Objects.equals(this.purpose, dnsRecord.purpose) && + Objects.equals(this.required, dnsRecord.required); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, value, priority, ttl, purpose, required); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DnsRecord {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" ttl: ").append(toIndentedString(ttl)).append("\n"); + sb.append(" purpose: ").append(toIndentedString(purpose)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationError.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationError.java new file mode 100644 index 0000000..20857ac --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationError.java @@ -0,0 +1,199 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * DnsVerificationError + */ +@JsonPropertyOrder({ + DnsVerificationError.JSON_PROPERTY_STATUS, + DnsVerificationError.JSON_PROPERTY_MISSING_RECORDS, + DnsVerificationError.JSON_PROPERTY_INCORRECT_RECORDS +}) +public class DnsVerificationError { + /** + * Gets or Sets status + */ + public enum StatusEnum { + ERROR("ERROR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_MISSING_RECORDS = "missingRecords"; + + @Nullable + private List missingRecords = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCORRECT_RECORDS = "incorrectRecords"; + + @Nullable + private List incorrectRecords = new ArrayList<>(); + + public DnsVerificationError() { + } + + public DnsVerificationError status(@Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@Nullable StatusEnum status) { + this.status = status; + } + + public DnsVerificationError missingRecords(@Nullable List missingRecords) { + this.missingRecords = missingRecords; + return this; + } + + public DnsVerificationError addMissingRecordsItem(DnsRecord missingRecordsItem) { + if (this.missingRecords == null) { + this.missingRecords = new ArrayList<>(); + } + this.missingRecords.add(missingRecordsItem); + return this; + } + + /** + * Get missingRecords + * @return missingRecords + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_MISSING_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getMissingRecords() { + return missingRecords; + } + + @JsonProperty(value = JSON_PROPERTY_MISSING_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMissingRecords(@Nullable List missingRecords) { + this.missingRecords = missingRecords; + } + + public DnsVerificationError incorrectRecords( + @Nullable List incorrectRecords) { + this.incorrectRecords = incorrectRecords; + return this; + } + + public DnsVerificationError addIncorrectRecordsItem( + DnsVerificationErrorIncorrectRecordsInner incorrectRecordsItem) { + if (this.incorrectRecords == null) { + this.incorrectRecords = new ArrayList<>(); + } + this.incorrectRecords.add(incorrectRecordsItem); + return this; + } + + /** + * Get incorrectRecords + * @return incorrectRecords + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_INCORRECT_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncorrectRecords() { + return incorrectRecords; + } + + @JsonProperty(value = JSON_PROPERTY_INCORRECT_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIncorrectRecords(@Nullable List incorrectRecords) { + this.incorrectRecords = incorrectRecords; + } + + /** + * Return true if this DnsVerificationError object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DnsVerificationError dnsVerificationError = (DnsVerificationError) o; + return Objects.equals(this.status, dnsVerificationError.status) && + Objects.equals(this.missingRecords, dnsVerificationError.missingRecords) && + Objects.equals(this.incorrectRecords, dnsVerificationError.incorrectRecords); + } + + @Override + public int hashCode() { + return Objects.hash(status, missingRecords, incorrectRecords); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DnsVerificationError {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" missingRecords: ").append(toIndentedString(missingRecords)).append("\n"); + sb.append(" incorrectRecords: ").append(toIndentedString(incorrectRecords)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInner.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInner.java new file mode 100644 index 0000000..be32322 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInner.java @@ -0,0 +1,144 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * DnsVerificationErrorIncorrectRecordsInner + */ +@JsonPropertyOrder({ + DnsVerificationErrorIncorrectRecordsInner.JSON_PROPERTY_RECORD, + DnsVerificationErrorIncorrectRecordsInner.JSON_PROPERTY_FOUND, + DnsVerificationErrorIncorrectRecordsInner.JSON_PROPERTY_EXPECTED +}) +public class DnsVerificationErrorIncorrectRecordsInner { + public static final String JSON_PROPERTY_RECORD = "record"; + + @Nullable + private DnsRecord record; + + public static final String JSON_PROPERTY_FOUND = "found"; + + @Nullable + private String found; + + public static final String JSON_PROPERTY_EXPECTED = "expected"; + + @Nullable + private String expected; + + public DnsVerificationErrorIncorrectRecordsInner() { + } + + public DnsVerificationErrorIncorrectRecordsInner record(@Nullable DnsRecord record) { + this.record = record; + return this; + } + + /** + * Get record + * @return record + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DnsRecord getRecord() { + return record; + } + + @JsonProperty(value = JSON_PROPERTY_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRecord(@Nullable DnsRecord record) { + this.record = record; + } + + public DnsVerificationErrorIncorrectRecordsInner found(@Nullable String found) { + this.found = found; + return this; + } + + /** + * The live record value observed when a record exists but does not match the required value. + * @return found + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_FOUND, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFound() { + return found; + } + + @JsonProperty(value = JSON_PROPERTY_FOUND, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFound(@Nullable String found) { + this.found = found; + } + + public DnsVerificationErrorIncorrectRecordsInner expected(@Nullable String expected) { + this.expected = expected; + return this; + } + + /** + * The required value; equals record.value. + * @return expected + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_EXPECTED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getExpected() { + return expected; + } + + @JsonProperty(value = JSON_PROPERTY_EXPECTED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpected(@Nullable String expected) { + this.expected = expected; + } + + /** + * Return true if this DnsVerificationError_incorrectRecords_inner object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DnsVerificationErrorIncorrectRecordsInner dnsVerificationErrorIncorrectRecordsInner = + (DnsVerificationErrorIncorrectRecordsInner) o; + return Objects.equals(this.record, dnsVerificationErrorIncorrectRecordsInner.record) && + Objects.equals(this.found, dnsVerificationErrorIncorrectRecordsInner.found) && + Objects.equals(this.expected, dnsVerificationErrorIncorrectRecordsInner.expected); + } + + @Override + public int hashCode() { + return Objects.hash(record, found, expected); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DnsVerificationErrorIncorrectRecordsInner {\n"); + sb.append(" record: ").append(toIndentedString(record)).append("\n"); + sb.append(" found: ").append(toIndentedString(found)).append("\n"); + sb.append(" expected: ").append(toIndentedString(expected)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ErrorResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ErrorResponse.java new file mode 100644 index 0000000..74a019f --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ErrorResponse.java @@ -0,0 +1,222 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * ErrorResponse + */ +@JsonPropertyOrder({ + ErrorResponse.JSON_PROPERTY_STATUS, + ErrorResponse.JSON_PROPERTY_CODE, + ErrorResponse.JSON_PROPERTY_MESSAGE, + ErrorResponse.JSON_PROPERTY_DETAILS +}) +public class ErrorResponse { + /** + * Gets or Sets status + */ + public enum StatusEnum { + ERROR("ERROR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_CODE = "code"; + + + @Nonnull + private String code; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + + + @Nonnull + private String message; + + public static final String JSON_PROPERTY_DETAILS = "details"; + + @Nullable + private Map details = new HashMap<>(); + + public ErrorResponse() { + } + + public ErrorResponse status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public ErrorResponse code(@Nonnull String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + @JsonProperty(value = JSON_PROPERTY_CODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCode(@Nonnull String code) { + this.code = code; + } + + public ErrorResponse message(@Nonnull String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMessage(@Nonnull String message) { + this.message = message; + } + + public ErrorResponse details(@Nullable Map details) { + this.details = details; + return this; + } + + public ErrorResponse putDetailsItem(String key, Object detailsItem) { + if (this.details == null) { + this.details = new HashMap<>(); + } + this.details.put(key, detailsItem); + return this; + } + + /** + * Get details + * @return details + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DETAILS, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public Map getDetails() { + return details; + } + + @JsonProperty(value = JSON_PROPERTY_DETAILS, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setDetails(@Nullable Map details) { + this.details = details; + } + + /** + * Return true if this ErrorResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.status, errorResponse.status) && + Objects.equals(this.code, errorResponse.code) && + Objects.equals(this.message, errorResponse.message) && + Objects.equals(this.details, errorResponse.details); + } + + @Override + public int hashCode() { + return Objects.hash(status, code, message, details); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventItem.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventItem.java new file mode 100644 index 0000000..3179986 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventItem.java @@ -0,0 +1,477 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * One ANS lifecycle event with agent details and event metadata. + */ +@JsonPropertyOrder({ + EventItem.JSON_PROPERTY_LOG_ID, + EventItem.JSON_PROPERTY_EVENT_TYPE, + EventItem.JSON_PROPERTY_CREATED_AT, + EventItem.JSON_PROPERTY_EXPIRES_AT, + EventItem.JSON_PROPERTY_AGENT_ID, + EventItem.JSON_PROPERTY_ANS_NAME, + EventItem.JSON_PROPERTY_AGENT_HOST, + EventItem.JSON_PROPERTY_AGENT_DISPLAY_NAME, + EventItem.JSON_PROPERTY_AGENT_DESCRIPTION, + EventItem.JSON_PROPERTY_VERSION, + EventItem.JSON_PROPERTY_PROVIDER_ID, + EventItem.JSON_PROPERTY_ENDPOINTS +}) +public class EventItem { + public static final String JSON_PROPERTY_LOG_ID = "logId"; + + + @Nonnull + private String logId; + + /** + * Type of ANS event. + */ + public enum EventTypeEnum { + AGENT_DEPRECATED("AGENT_DEPRECATED"), + + AGENT_REGISTERED("AGENT_REGISTERED"), + + AGENT_REVOKED("AGENT_REVOKED"), + + AGENT_RENEWED("AGENT_RENEWED"); + + private String value; + + EventTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static EventTypeEnum fromValue(String value) { + for (EventTypeEnum b : EventTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_EVENT_TYPE = "eventType"; + + + @Nonnull + private EventTypeEnum eventType; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + + + @Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + @Nullable + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + + @Nonnull + private UUID agentId; + + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_AGENT_HOST = "agentHost"; + + + @Nonnull + private String agentHost; + + public static final String JSON_PROPERTY_AGENT_DISPLAY_NAME = "agentDisplayName"; + + @Nullable + private String agentDisplayName; + + public static final String JSON_PROPERTY_AGENT_DESCRIPTION = "agentDescription"; + + @Nullable + private String agentDescription; + + public static final String JSON_PROPERTY_VERSION = "version"; + + + @Nonnull + private String version; + + public static final String JSON_PROPERTY_PROVIDER_ID = "providerId"; + + @Nullable + private String providerId; + + public static final String JSON_PROPERTY_ENDPOINTS = "endpoints"; + + @Nullable + private List endpoints = new ArrayList<>(); + + public EventItem() { + } + + public EventItem logId(@Nonnull String logId) { + this.logId = logId; + return this; + } + + /** + * Unique identifier for this event in the stream. + * @return logId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LOG_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLogId() { + return logId; + } + + @JsonProperty(value = JSON_PROPERTY_LOG_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLogId(@Nonnull String logId) { + this.logId = logId; + } + + public EventItem eventType(@Nonnull EventTypeEnum eventType) { + this.eventType = eventType; + return this; + } + + /** + * Type of ANS event. + * @return eventType + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public EventTypeEnum getEventType() { + return eventType; + } + + @JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEventType(@Nonnull EventTypeEnum eventType) { + this.eventType = eventType; + } + + public EventItem createdAt(@Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp when the event was created (producer time). + * @return createdAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public EventItem expiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * When the agent's registration expires (if applicable). + * @return expiresAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public EventItem agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Unique identifier of the agent. + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public EventItem ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Fully qualified ANS name (ans://{version}.{agentHost}). + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public EventItem agentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + return this; + } + + /** + * The agent's hosting domain. + * @return agentHost + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAgentHost() { + return agentHost; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_HOST, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentHost(@Nonnull String agentHost) { + this.agentHost = agentHost; + } + + public EventItem agentDisplayName(@Nullable String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + return this; + } + + /** + * Human-readable display name for the agent. + * @return agentDisplayName + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAgentDisplayName() { + return agentDisplayName; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DISPLAY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgentDisplayName(@Nullable String agentDisplayName) { + this.agentDisplayName = agentDisplayName; + } + + public EventItem agentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + return this; + } + + /** + * Description of the agent. + * @return agentDescription + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAgentDescription() { + return agentDescription; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgentDescription(@Nullable String agentDescription) { + this.agentDescription = agentDescription; + } + + public EventItem version(@Nonnull String version) { + this.version = version; + return this; + } + + /** + * Semantic version of the agent. + * @return version + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setVersion(@Nonnull String version) { + this.version = version; + } + + public EventItem providerId(@Nullable String providerId) { + this.providerId = providerId; + return this; + } + + /** + * Provider identifier (production field). This OSS RA never emits it — the only principal id is the + * registrant's owner id, which is not exposed. + * @return providerId + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PROVIDER_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProviderId() { + return providerId; + } + + @JsonProperty(value = JSON_PROPERTY_PROVIDER_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProviderId(@Nullable String providerId) { + this.providerId = providerId; + } + + public EventItem endpoints(@Nullable List endpoints) { + this.endpoints = endpoints; + return this; + } + + public EventItem addEndpointsItem(AgentEndpoint endpointsItem) { + if (this.endpoints == null) { + this.endpoints = new ArrayList<>(); + } + this.endpoints.add(endpointsItem); + return this; + } + + /** + * Agent endpoints with protocol-specific configuration. + * @return endpoints + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEndpoints() { + return endpoints; + } + + @JsonProperty(value = JSON_PROPERTY_ENDPOINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEndpoints(@Nullable List endpoints) { + this.endpoints = endpoints; + } + + /** + * Return true if this EventItem object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventItem eventItem = (EventItem) o; + return Objects.equals(this.logId, eventItem.logId) && + Objects.equals(this.eventType, eventItem.eventType) && + Objects.equals(this.createdAt, eventItem.createdAt) && + Objects.equals(this.expiresAt, eventItem.expiresAt) && + Objects.equals(this.agentId, eventItem.agentId) && + Objects.equals(this.ansName, eventItem.ansName) && + Objects.equals(this.agentHost, eventItem.agentHost) && + Objects.equals(this.agentDisplayName, eventItem.agentDisplayName) && + Objects.equals(this.agentDescription, eventItem.agentDescription) && + Objects.equals(this.version, eventItem.version) && + Objects.equals(this.providerId, eventItem.providerId) && + Objects.equals(this.endpoints, eventItem.endpoints); + } + + @Override + public int hashCode() { + return Objects.hash(logId, eventType, createdAt, expiresAt, agentId, ansName, agentHost, agentDisplayName, + agentDescription, version, providerId, endpoints); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventItem {\n"); + sb.append(" logId: ").append(toIndentedString(logId)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" agentHost: ").append(toIndentedString(agentHost)).append("\n"); + sb.append(" agentDisplayName: ").append(toIndentedString(agentDisplayName)).append("\n"); + sb.append(" agentDescription: ").append(toIndentedString(agentDescription)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" providerId: ").append(toIndentedString(providerId)).append("\n"); + sb.append(" endpoints: ").append(toIndentedString(endpoints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventPageResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventPageResponse.java new file mode 100644 index 0000000..1550b6e --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/EventPageResponse.java @@ -0,0 +1,126 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Paginated response containing ANS events. + */ +@JsonPropertyOrder({ + EventPageResponse.JSON_PROPERTY_ITEMS, + EventPageResponse.JSON_PROPERTY_LAST_LOG_ID +}) +public class EventPageResponse { + public static final String JSON_PROPERTY_ITEMS = "items"; + + @Nonnull + private List items = new ArrayList<>(); + + public static final String JSON_PROPERTY_LAST_LOG_ID = "lastLogId"; + + @Nullable + private String lastLogId; + + public EventPageResponse() { + } + + public EventPageResponse items(@Nonnull List items) { + this.items = items; + return this; + } + + public EventPageResponse addItemsItem(EventItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Array of event items (always present; `[]` when empty). + * @return items + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getItems() { + return items; + } + + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setItems(@Nonnull List items) { + this.items = items; + } + + public EventPageResponse lastLogId(@Nullable String lastLogId) { + this.lastLogId = lastLogId; + return this; + } + + /** + * The logId of the last event in this page. Pass it as the next request's `lastLogId` to fetch the + * following page. Omitted when there are no more results. + * @return lastLogId + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LAST_LOG_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastLogId() { + return lastLogId; + } + + @JsonProperty(value = JSON_PROPERTY_LAST_LOG_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastLogId(@Nullable String lastLogId) { + this.lastLogId = lastLogId; + } + + /** + * Return true if this EventPageResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventPageResponse eventPageResponse = (EventPageResponse) o; + return Objects.equals(this.items, eventPageResponse.items) && + Objects.equals(this.lastLogId, eventPageResponse.lastLogId); + } + + @Override + public int hashCode() { + return Objects.hash(items, lastLogId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventPageResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" lastLogId: ").append(toIndentedString(lastLogId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityChallengeResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityChallengeResponse.java new file mode 100644 index 0000000..0ea1817 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityChallengeResponse.java @@ -0,0 +1,395 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * The 202 challenge round. Every entry shares the same anti-replay nonce and the same signingInput — the input is + * key-independent; entries enumerate the keys the resolver could see in advance (a single unkeyed entry when it could + * not — name keys via the JWS `kid` header at verify time). + */ +@JsonPropertyOrder({ + IdentityChallengeResponse.JSON_PROPERTY_IDENTITY_ID, + IdentityChallengeResponse.JSON_PROPERTY_KIND, + IdentityChallengeResponse.JSON_PROPERTY_VALUE, + IdentityChallengeResponse.JSON_PROPERTY_STATUS, + IdentityChallengeResponse.JSON_PROPERTY_NONCE, + IdentityChallengeResponse.JSON_PROPERTY_EXPIRES_AT, + IdentityChallengeResponse.JSON_PROPERTY_CHALLENGES, + IdentityChallengeResponse.JSON_PROPERTY_PRESENTATION_STATUS +}) +public class IdentityChallengeResponse { + public static final String JSON_PROPERTY_IDENTITY_ID = "identityId"; + + + @Nonnull + private String identityId; + + /** + * Gets or Sets kind + */ + public enum KindEnum { + DID_WEB("did:web"), + + DID_KEY("did:key"), + + LEI("lei"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + + + @Nonnull + private KindEnum kind; + + public static final String JSON_PROPERTY_VALUE = "value"; + + + @Nonnull + private String value; + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private IdentityLifecycleStatus status; + + public static final String JSON_PROPERTY_NONCE = "nonce"; + + + @Nonnull + private String nonce; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + + @Nonnull + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_CHALLENGES = "challenges"; + + + @Nonnull + private List challenges = new ArrayList<>(); + + /** + * The lei register-time advisory authorization status from the vlei-verifier + * (`AUTHORIZED` | `PENDING`). Omitted for kinds with no register-time presentation + * (`did:web`, `did:key`). Advisory only — control is finally established by a LIVE + * re-authorization at verify-control. + */ + public enum PresentationStatusEnum { + AUTHORIZED("AUTHORIZED"), + + PENDING("PENDING"); + + private String value; + + PresentationStatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static PresentationStatusEnum fromValue(String value) { + for (PresentationStatusEnum b : PresentationStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_PRESENTATION_STATUS = "presentationStatus"; + + @Nullable + private PresentationStatusEnum presentationStatus; + + public IdentityChallengeResponse() { + } + + public IdentityChallengeResponse identityId(@Nonnull String identityId) { + this.identityId = identityId; + return this; + } + + /** + * RA-assigned UUIDv7 — the TL stream key + * @return identityId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentityId() { + return identityId; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentityId(@Nonnull String identityId) { + this.identityId = identityId; + } + + public IdentityChallengeResponse kind(@Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public KindEnum getKind() { + return kind; + } + + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKind(@Nonnull KindEnum kind) { + this.kind = kind; + } + + public IdentityChallengeResponse value(@Nonnull String value) { + this.value = value; + return this; + } + + /** + * The canonical identifier this round proves + * @return value + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@Nonnull String value) { + this.value = value; + } + + public IdentityChallengeResponse status(@Nonnull IdentityLifecycleStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IdentityLifecycleStatus getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull IdentityLifecycleStatus status) { + this.status = status; + } + + public IdentityChallengeResponse nonce(@Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Base64url 32-byte single-use anti-replay nonce + * @return nonce + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NONCE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getNonce() { + return nonce; + } + + @JsonProperty(value = JSON_PROPERTY_NONCE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNonce(@Nonnull String nonce) { + this.nonce = nonce; + } + + public IdentityChallengeResponse expiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setExpiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public IdentityChallengeResponse challenges(@Nonnull List challenges) { + this.challenges = challenges; + return this; + } + + public IdentityChallengeResponse addChallengesItem(IdentityProofChallenge challengesItem) { + if (this.challenges == null) { + this.challenges = new ArrayList<>(); + } + this.challenges.add(challengesItem); + return this; + } + + /** + * Get challenges + * @return challenges + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getChallenges() { + return challenges; + } + + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setChallenges(@Nonnull List challenges) { + this.challenges = challenges; + } + + public IdentityChallengeResponse presentationStatus(@Nullable PresentationStatusEnum presentationStatus) { + this.presentationStatus = presentationStatus; + return this; + } + + /** + * The lei register-time advisory authorization status from the vlei-verifier + * (`AUTHORIZED` | `PENDING`). Omitted for kinds with no register-time presentation + * (`did:web`, `did:key`). Advisory only — control is finally established by a LIVE + * re-authorization at verify-control. + * @return presentationStatus + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PRESENTATION_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PresentationStatusEnum getPresentationStatus() { + return presentationStatus; + } + + @JsonProperty(value = JSON_PROPERTY_PRESENTATION_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPresentationStatus(@Nullable PresentationStatusEnum presentationStatus) { + this.presentationStatus = presentationStatus; + } + + /** + * Return true if this IdentityChallengeResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityChallengeResponse identityChallengeResponse = (IdentityChallengeResponse) o; + return Objects.equals(this.identityId, identityChallengeResponse.identityId) && + Objects.equals(this.kind, identityChallengeResponse.kind) && + Objects.equals(this.value, identityChallengeResponse.value) && + Objects.equals(this.status, identityChallengeResponse.status) && + Objects.equals(this.nonce, identityChallengeResponse.nonce) && + Objects.equals(this.expiresAt, identityChallengeResponse.expiresAt) && + Objects.equals(this.challenges, identityChallengeResponse.challenges) && + Objects.equals(this.presentationStatus, identityChallengeResponse.presentationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(identityId, kind, value, status, nonce, expiresAt, challenges, presentationStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityChallengeResponse {\n"); + sb.append(" identityId: ").append(toIndentedString(identityId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" challenges: ").append(toIndentedString(challenges)).append("\n"); + sb.append(" presentationStatus: ").append(toIndentedString(presentationStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetails.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetails.java new file mode 100644 index 0000000..c93e51d --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetails.java @@ -0,0 +1,418 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * IdentityDetails + */ +@JsonPropertyOrder({ + IdentityDetails.JSON_PROPERTY_IDENTITY_ID, + IdentityDetails.JSON_PROPERTY_KIND, + IdentityDetails.JSON_PROPERTY_VALUE, + IdentityDetails.JSON_PROPERTY_STATUS, + IdentityDetails.JSON_PROPERTY_PROOF_METHOD, + IdentityDetails.JSON_PROPERTY_PENDING_VALUE, + IdentityDetails.JSON_PROPERTY_VERIFIED_AT, + IdentityDetails.JSON_PROPERTY_CREATED_AT, + IdentityDetails.JSON_PROPERTY_LINKED_AGENTS +}) +public class IdentityDetails { + public static final String JSON_PROPERTY_IDENTITY_ID = "identityId"; + + + @Nonnull + private String identityId; + + /** + * Gets or Sets kind + */ + public enum KindEnum { + DID_WEB("did:web"), + + DID_KEY("did:key"), + + LEI("lei"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + + + @Nonnull + private KindEnum kind; + + public static final String JSON_PROPERTY_VALUE = "value"; + + + @Nonnull + private String value; + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private IdentityLifecycleStatus status; + + /** + * Control proof that verified this identity + */ + public enum ProofMethodEnum { + DID_WEB_SIG("did-web-sig"), + + DID_KEY_SIG("did-key-sig"), + + LEI_VLEI_ACDC("lei-vlei-acdc"); + + private String value; + + ProofMethodEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static ProofMethodEnum fromValue(String value) { + for (ProofMethodEnum b : ProofMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_PROOF_METHOD = "proofMethod"; + + @Nullable + private ProofMethodEnum proofMethod; + + public static final String JSON_PROPERTY_PENDING_VALUE = "pendingValue"; + + @Nullable + private String pendingValue; + + public static final String JSON_PROPERTY_VERIFIED_AT = "verifiedAt"; + + @Nullable + private OffsetDateTime verifiedAt; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + + + @Nonnull + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_LINKED_AGENTS = "linkedAgents"; + + @Nullable + private List linkedAgents = new ArrayList<>(); + + public IdentityDetails() { + } + + public IdentityDetails identityId(@Nonnull String identityId) { + this.identityId = identityId; + return this; + } + + /** + * Get identityId + * @return identityId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentityId() { + return identityId; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentityId(@Nonnull String identityId) { + this.identityId = identityId; + } + + public IdentityDetails kind(@Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public KindEnum getKind() { + return kind; + } + + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKind(@Nonnull KindEnum kind) { + this.kind = kind; + } + + public IdentityDetails value(@Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@Nonnull String value) { + this.value = value; + } + + public IdentityDetails status(@Nonnull IdentityLifecycleStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IdentityLifecycleStatus getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull IdentityLifecycleStatus status) { + this.status = status; + } + + public IdentityDetails proofMethod(@Nullable ProofMethodEnum proofMethod) { + this.proofMethod = proofMethod; + return this; + } + + /** + * Control proof that verified this identity + * @return proofMethod + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PROOF_METHOD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ProofMethodEnum getProofMethod() { + return proofMethod; + } + + @JsonProperty(value = JSON_PROPERTY_PROOF_METHOD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProofMethod(@Nullable ProofMethodEnum proofMethod) { + this.proofMethod = proofMethod; + } + + public IdentityDetails pendingValue(@Nullable String pendingValue) { + this.pendingValue = pendingValue; + return this; + } + + /** + * Staged rotation replacement (empty unless rotating) + * @return pendingValue + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_PENDING_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPendingValue() { + return pendingValue; + } + + @JsonProperty(value = JSON_PROPERTY_PENDING_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPendingValue(@Nullable String pendingValue) { + this.pendingValue = pendingValue; + } + + public IdentityDetails verifiedAt(@Nullable OffsetDateTime verifiedAt) { + this.verifiedAt = verifiedAt; + return this; + } + + /** + * Get verifiedAt + * @return verifiedAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_VERIFIED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getVerifiedAt() { + return verifiedAt; + } + + @JsonProperty(value = JSON_PROPERTY_VERIFIED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVerifiedAt(@Nullable OffsetDateTime verifiedAt) { + this.verifiedAt = verifiedAt; + } + + public IdentityDetails createdAt(@Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCreatedAt(@Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public IdentityDetails linkedAgents(@Nullable List linkedAgents) { + this.linkedAgents = linkedAgents; + return this; + } + + public IdentityDetails addLinkedAgentsItem(IdentityDetailsLinkedAgentsInner linkedAgentsItem) { + if (this.linkedAgents == null) { + this.linkedAgents = new ArrayList<>(); + } + this.linkedAgents.add(linkedAgentsItem); + return this; + } + + /** + * Live links (detail responses only) + * @return linkedAgents + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LINKED_AGENTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getLinkedAgents() { + return linkedAgents; + } + + @JsonProperty(value = JSON_PROPERTY_LINKED_AGENTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinkedAgents(@Nullable List linkedAgents) { + this.linkedAgents = linkedAgents; + } + + /** + * Return true if this IdentityDetails object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityDetails identityDetails = (IdentityDetails) o; + return Objects.equals(this.identityId, identityDetails.identityId) && + Objects.equals(this.kind, identityDetails.kind) && + Objects.equals(this.value, identityDetails.value) && + Objects.equals(this.status, identityDetails.status) && + Objects.equals(this.proofMethod, identityDetails.proofMethod) && + Objects.equals(this.pendingValue, identityDetails.pendingValue) && + Objects.equals(this.verifiedAt, identityDetails.verifiedAt) && + Objects.equals(this.createdAt, identityDetails.createdAt) && + Objects.equals(this.linkedAgents, identityDetails.linkedAgents); + } + + @Override + public int hashCode() { + return Objects.hash(identityId, kind, value, status, proofMethod, pendingValue, verifiedAt, createdAt, + linkedAgents); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityDetails {\n"); + sb.append(" identityId: ").append(toIndentedString(identityId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" proofMethod: ").append(toIndentedString(proofMethod)).append("\n"); + sb.append(" pendingValue: ").append(toIndentedString(pendingValue)).append("\n"); + sb.append(" verifiedAt: ").append(toIndentedString(verifiedAt)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" linkedAgents: ").append(toIndentedString(linkedAgents)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInner.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInner.java new file mode 100644 index 0000000..d255e24 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInner.java @@ -0,0 +1,117 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * IdentityDetailsLinkedAgentsInner + */ +@JsonPropertyOrder({ + IdentityDetailsLinkedAgentsInner.JSON_PROPERTY_AGENT_ID, + IdentityDetailsLinkedAgentsInner.JSON_PROPERTY_LINKED_AT +}) +public class IdentityDetailsLinkedAgentsInner { + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + @Nonnull + private UUID agentId; + + public static final String JSON_PROPERTY_LINKED_AT = "linkedAt"; + + @Nullable + private OffsetDateTime linkedAt; + + public IdentityDetailsLinkedAgentsInner() { + } + + public IdentityDetailsLinkedAgentsInner agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Get agentId + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public IdentityDetailsLinkedAgentsInner linkedAt(@Nullable OffsetDateTime linkedAt) { + this.linkedAt = linkedAt; + return this; + } + + /** + * Get linkedAt + * @return linkedAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LINKED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getLinkedAt() { + return linkedAt; + } + + @JsonProperty(value = JSON_PROPERTY_LINKED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinkedAt(@Nullable OffsetDateTime linkedAt) { + this.linkedAt = linkedAt; + } + + /** + * Return true if this IdentityDetails_linkedAgents_inner object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityDetailsLinkedAgentsInner identityDetailsLinkedAgentsInner = (IdentityDetailsLinkedAgentsInner) o; + return Objects.equals(this.agentId, identityDetailsLinkedAgentsInner.agentId) && + Objects.equals(this.linkedAt, identityDetailsLinkedAgentsInner.linkedAt); + } + + @Override + public int hashCode() { + return Objects.hash(agentId, linkedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityDetailsLinkedAgentsInner {\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" linkedAt: ").append(toIndentedString(linkedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatus.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatus.java new file mode 100644 index 0000000..79935e3 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatus.java @@ -0,0 +1,44 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * PENDING_CONTROL → VERIFIED → REVOKED. Rotation keeps the row VERIFIED (the staged replacement proves control before + * anything changes). + */ +public enum IdentityLifecycleStatus { + + PENDING_CONTROL("PENDING_CONTROL"), + + VERIFIED("VERIFIED"), + + REVOKED("REVOKED"); + + private String value; + + IdentityLifecycleStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static IdentityLifecycleStatus fromValue(String value) { + for (IdentityLifecycleStatus b : IdentityLifecycleStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkRequest.java new file mode 100644 index 0000000..7489d0b --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkRequest.java @@ -0,0 +1,96 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * The batch of the caller's agents to bind — one owner-gated call, no challenge, no signature; the whole batch + * seals as ONE IDENTITY_LINKED event on the identity stream. + */ +@JsonPropertyOrder({ + IdentityLinkRequest.JSON_PROPERTY_AGENT_IDS +}) +public class IdentityLinkRequest { + public static final String JSON_PROPERTY_AGENT_IDS = "agentIds"; + + @Nonnull + private List agentIds = new ArrayList<>(); + + public IdentityLinkRequest() { + } + + public IdentityLinkRequest agentIds(@Nonnull List agentIds) { + this.agentIds = agentIds; + return this; + } + + public IdentityLinkRequest addAgentIdsItem(UUID agentIdsItem) { + if (this.agentIds == null) { + this.agentIds = new ArrayList<>(); + } + this.agentIds.add(agentIdsItem); + return this; + } + + /** + * Get agentIds + * @return agentIds + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAgentIds() { + return agentIds; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_IDS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentIds(@Nonnull List agentIds) { + this.agentIds = agentIds; + } + + /** + * Return true if this IdentityLinkRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityLinkRequest identityLinkRequest = (IdentityLinkRequest) o; + return Objects.equals(this.agentIds, identityLinkRequest.agentIds); + } + + @Override + public int hashCode() { + return Objects.hash(agentIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityLinkRequest {\n"); + sb.append(" agentIds: ").append(toIndentedString(agentIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkResponse.java new file mode 100644 index 0000000..f74190a --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityLinkResponse.java @@ -0,0 +1,83 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * IdentityLinkResponse + */ +@JsonPropertyOrder({ + IdentityLinkResponse.JSON_PROPERTY_LINKED +}) +public class IdentityLinkResponse { + public static final String JSON_PROPERTY_LINKED = "linked"; + + @Nonnull + private Integer linked; + + public IdentityLinkResponse() { + } + + public IdentityLinkResponse linked(@Nonnull Integer linked) { + this.linked = linked; + return this; + } + + /** + * Newly-created links (already-linked agents are skipped) + * @return linked + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LINKED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getLinked() { + return linked; + } + + @JsonProperty(value = JSON_PROPERTY_LINKED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLinked(@Nonnull Integer linked) { + this.linked = linked; + } + + /** + * Return true if this IdentityLinkResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityLinkResponse identityLinkResponse = (IdentityLinkResponse) o; + return Objects.equals(this.linked, identityLinkResponse.linked); + } + + @Override + public int hashCode() { + return Objects.hash(linked); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityLinkResponse {\n"); + sb.append(" linked: ").append(toIndentedString(linked)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java new file mode 100644 index 0000000..a64f9b6 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java @@ -0,0 +1,217 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Ownership-scoped, cursor-paginated list of the caller's verified identities. Mirrors + * `AgentListResponse`: the collection array is named `items` per the standard REST + * collection-response convention shared across the v2 surface. + */ +@JsonPropertyOrder({ + IdentityListResponse.JSON_PROPERTY_ITEMS, + IdentityListResponse.JSON_PROPERTY_RETURNED_COUNT, + IdentityListResponse.JSON_PROPERTY_LIMIT, + IdentityListResponse.JSON_PROPERTY_NEXT_CURSOR, + IdentityListResponse.JSON_PROPERTY_HAS_MORE +})public class IdentityListResponse { + public static final String JSON_PROPERTY_ITEMS = "items"; + + @Nonnull + private List items = new ArrayList<>(); + + public static final String JSON_PROPERTY_RETURNED_COUNT = "returnedCount"; + + @Nonnull + private Integer returnedCount; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + + @Nonnull + private Integer limit; + + public static final String JSON_PROPERTY_NEXT_CURSOR = "nextCursor"; + + @Nullable + private String nextCursor; + + public static final String JSON_PROPERTY_HAS_MORE = "hasMore"; + + @Nonnull + private Boolean hasMore; + + public IdentityListResponse() { + } + + public IdentityListResponse items(@Nonnull List items) { + this.items = items; + return this; + } + + public IdentityListResponse addItemsItem(IdentityDetails itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of identities owned by the caller + * @return items + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getItems() { + return items; + } + + @JsonProperty(value = JSON_PROPERTY_ITEMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setItems(@Nonnull List items) { + this.items = items; + } + + public IdentityListResponse returnedCount(@Nonnull Integer returnedCount) { + this.returnedCount = returnedCount; + return this; + } + + /** + * Number of identities in this response + * @return returnedCount + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_RETURNED_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getReturnedCount() { + return returnedCount; + } + + @JsonProperty(value = JSON_PROPERTY_RETURNED_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReturnedCount(@Nonnull Integer returnedCount) { + this.returnedCount = returnedCount; + } + + public IdentityListResponse limit(@Nonnull Integer limit) { + this.limit = limit; + return this; + } + + /** + * Limit that was applied + * @return limit + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getLimit() { + return limit; + } + + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLimit(@Nonnull Integer limit) { + this.limit = limit; + } + + public IdentityListResponse nextCursor(@Nullable String nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + /** + * Opaque cursor for the next page. Pass as the `cursor` query parameter to retrieve the next page. Null + * when there are no more results. + * @return nextCursor + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNextCursor() { + return nextCursor; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNextCursor(@Nullable String nextCursor) { + this.nextCursor = nextCursor; + } + + public IdentityListResponse hasMore(@Nonnull Boolean hasMore) { + this.hasMore = hasMore; + return this; + } + + /** + * Whether more results exist beyond this page + * @return hasMore + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasMore() { + return hasMore; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_MORE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setHasMore(@Nonnull Boolean hasMore) { + this.hasMore = hasMore; + } + + /** + * Return true if this IdentityListResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityListResponse identityListResponse = (IdentityListResponse) o; + return Objects.equals(this.items, identityListResponse.items) && + Objects.equals(this.returnedCount, identityListResponse.returnedCount) && + Objects.equals(this.limit, identityListResponse.limit) && + Objects.equals(this.nextCursor, identityListResponse.nextCursor) && + Objects.equals(this.hasMore, identityListResponse.hasMore); + } + + @Override + public int hashCode() { + return Objects.hash(items, returnedCount, limit, nextCursor, hasMore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" returnedCount: ").append(toIndentedString(returnedCount)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityProofChallenge.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityProofChallenge.java new file mode 100644 index 0000000..d561bcc --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityProofChallenge.java @@ -0,0 +1,116 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * IdentityProofChallenge + */ +@JsonPropertyOrder({ + IdentityProofChallenge.JSON_PROPERTY_KID, + IdentityProofChallenge.JSON_PROPERTY_SIGNING_INPUT +}) +public class IdentityProofChallenge { + public static final String JSON_PROPERTY_KID = "kid"; + + @Nullable + private String kid; + + public static final String JSON_PROPERTY_SIGNING_INPUT = "signingInput"; + + @Nonnull + private String signingInput; + + public IdentityProofChallenge() { + } + + public IdentityProofChallenge kid(@Nullable String kid) { + this.kid = kid; + return this; + } + + /** + * Verification-method id eligible to sign this round (omitted when the resolver could not enumerate keys) + * @return kid + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_KID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getKid() { + return kid; + } + + @JsonProperty(value = JSON_PROPERTY_KID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setKid(@Nullable String kid) { + this.kid = kid; + } + + public IdentityProofChallenge signingInput(@Nonnull String signingInput) { + this.signingInput = signingInput; + return this; + } + + /** + * Base64url of the exact RFC 8785 (JCS) canonical IdentityProofInput bytes — {identifier, identityId, nonce, + * purpose:\"ans:identity-proof:v1\", raId, scheme}. A compact JWS's payload segment MUST equal this + * string verbatim; clients never canonicalize. + * @return signingInput + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_SIGNING_INPUT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSigningInput() { + return signingInput; + } + + @JsonProperty(value = JSON_PROPERTY_SIGNING_INPUT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSigningInput(@Nonnull String signingInput) { + this.signingInput = signingInput; + } + + /** + * Return true if this IdentityProofChallenge object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityProofChallenge identityProofChallenge = (IdentityProofChallenge) o; + return Objects.equals(this.kid, identityProofChallenge.kid) && + Objects.equals(this.signingInput, identityProofChallenge.signingInput); + } + + @Override + public int hashCode() { + return Objects.hash(kid, signingInput); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityProofChallenge {\n"); + sb.append(" kid: ").append(toIndentedString(kid)).append("\n"); + sb.append(" signingInput: ").append(toIndentedString(signingInput)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequest.java new file mode 100644 index 0000000..4cd19d4 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequest.java @@ -0,0 +1,115 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * Registers (POST) or rotates (PUT) an identifier. The kind is inferred from the value's lexical form — + * `did:web:` prefix, `did:key:` prefix, or a 20-character LEI — never caller-asserted. + */ +@JsonPropertyOrder({ + IdentityRegistrationRequest.JSON_PROPERTY_VALUE, + IdentityRegistrationRequest.JSON_PROPERTY_VLEI_PRESENTATION +}) +public class IdentityRegistrationRequest { + public static final String JSON_PROPERTY_VALUE = "value"; + + @Nonnull + private String value; + + public static final String JSON_PROPERTY_VLEI_PRESENTATION = "vleiPresentation"; + + @Nullable + private VLEIPresentation vleiPresentation; + + public IdentityRegistrationRequest() { + } + + public IdentityRegistrationRequest value(@Nonnull String value) { + this.value = value; + return this; + } + + /** + * The identifier to prove control of + * @return value + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@Nonnull String value) { + this.value = value; + } + + public IdentityRegistrationRequest vleiPresentation(@Nullable VLEIPresentation vleiPresentation) { + this.vleiPresentation = vleiPresentation; + return this; + } + + /** + * Get vleiPresentation + * @return vleiPresentation + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_VLEI_PRESENTATION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public VLEIPresentation getVleiPresentation() { + return vleiPresentation; + } + + @JsonProperty(value = JSON_PROPERTY_VLEI_PRESENTATION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVleiPresentation(@Nullable VLEIPresentation vleiPresentation) { + this.vleiPresentation = vleiPresentation; + } + + /** + * Return true if this IdentityRegistrationRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentityRegistrationRequest identityRegistrationRequest = (IdentityRegistrationRequest) o; + return Objects.equals(this.value, identityRegistrationRequest.value) && + Objects.equals(this.vleiPresentation, identityRegistrationRequest.vleiPresentation); + } + + @Override + public int hashCode() { + return Objects.hash(value, vleiPresentation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentityRegistrationRequest {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" vleiPresentation: ").append(toIndentedString(vleiPresentation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Link.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Link.java new file mode 100644 index 0000000..6228d1c --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Link.java @@ -0,0 +1,116 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * Link + */ +@JsonPropertyOrder({ + Link.JSON_PROPERTY_REL, + Link.JSON_PROPERTY_HREF +}) +public class Link { + public static final String JSON_PROPERTY_REL = "rel"; + + @Nonnull + private String rel; + + public static final String JSON_PROPERTY_HREF = "href"; + + @Nonnull + private URI href; + + public Link() { + } + + public Link rel(@Nonnull String rel) { + this.rel = rel; + return this; + } + + /** + * Get rel + * @return rel + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_REL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRel() { + return rel; + } + + @JsonProperty(value = JSON_PROPERTY_REL, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRel(@Nonnull String rel) { + this.rel = rel; + } + + public Link href(@Nonnull URI href) { + this.href = href; + return this; + } + + /** + * Get href + * @return href + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_HREF, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public URI getHref() { + return href; + } + + @JsonProperty(value = JSON_PROPERTY_HREF, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setHref(@Nonnull URI href) { + this.href = href; + } + + /** + * Return true if this Link object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Link link = (Link) o; + return Objects.equals(this.rel, link.rel) && + Objects.equals(this.href, link.href); + } + + @Override + public int hashCode() { + return Objects.hash(rel, href); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Link {\n"); + sb.append(" rel: ").append(toIndentedString(rel)).append("\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/LinkedIdentity.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/LinkedIdentity.java new file mode 100644 index 0000000..04708c1 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/LinkedIdentity.java @@ -0,0 +1,284 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * One computed identities[] entry on AgentDetails. + */ +@JsonPropertyOrder({ + LinkedIdentity.JSON_PROPERTY_IDENTITY_ID, + LinkedIdentity.JSON_PROPERTY_KIND, + LinkedIdentity.JSON_PROPERTY_VALUE, + LinkedIdentity.JSON_PROPERTY_IDENTITY_STATUS, + LinkedIdentity.JSON_PROPERTY_LINKED_AT +}) +public class LinkedIdentity { + public static final String JSON_PROPERTY_IDENTITY_ID = "identityId"; + + + @Nonnull + private String identityId; + + /** + * Gets or Sets kind + */ + public enum KindEnum { + DID_WEB("did:web"), + + DID_KEY("did:key"), + + LEI("lei"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + + + @Nonnull + private KindEnum kind; + + public static final String JSON_PROPERTY_VALUE = "value"; + + + @Nonnull + private String value; + + /** + * The identity's CURRENT status — reflects its stream now + */ + public enum IdentityStatusEnum { + VERIFIED("VERIFIED"), + + REVOKED("REVOKED"); + + private String value; + + IdentityStatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static IdentityStatusEnum fromValue(String value) { + for (IdentityStatusEnum b : IdentityStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_IDENTITY_STATUS = "identityStatus"; + + + @Nonnull + private IdentityStatusEnum identityStatus; + + public static final String JSON_PROPERTY_LINKED_AT = "linkedAt"; + + @Nullable + private OffsetDateTime linkedAt; + + public LinkedIdentity() { + } + + public LinkedIdentity identityId(@Nonnull String identityId) { + this.identityId = identityId; + return this; + } + + /** + * Get identityId + * @return identityId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentityId() { + return identityId; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentityId(@Nonnull String identityId) { + this.identityId = identityId; + } + + public LinkedIdentity kind(@Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public KindEnum getKind() { + return kind; + } + + @JsonProperty(value = JSON_PROPERTY_KIND, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setKind(@Nonnull KindEnum kind) { + this.kind = kind; + } + + public LinkedIdentity value(@Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@Nonnull String value) { + this.value = value; + } + + public LinkedIdentity identityStatus(@Nonnull IdentityStatusEnum identityStatus) { + this.identityStatus = identityStatus; + return this; + } + + /** + * The identity's CURRENT status — reflects its stream now + * @return identityStatus + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_IDENTITY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IdentityStatusEnum getIdentityStatus() { + return identityStatus; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIdentityStatus(@Nonnull IdentityStatusEnum identityStatus) { + this.identityStatus = identityStatus; + } + + public LinkedIdentity linkedAt(@Nullable OffsetDateTime linkedAt) { + this.linkedAt = linkedAt; + return this; + } + + /** + * Get linkedAt + * @return linkedAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LINKED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getLinkedAt() { + return linkedAt; + } + + @JsonProperty(value = JSON_PROPERTY_LINKED_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinkedAt(@Nullable OffsetDateTime linkedAt) { + this.linkedAt = linkedAt; + } + + /** + * Return true if this LinkedIdentity object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LinkedIdentity linkedIdentity = (LinkedIdentity) o; + return Objects.equals(this.identityId, linkedIdentity.identityId) && + Objects.equals(this.kind, linkedIdentity.kind) && + Objects.equals(this.value, linkedIdentity.value) && + Objects.equals(this.identityStatus, linkedIdentity.identityStatus) && + Objects.equals(this.linkedAt, linkedIdentity.linkedAt); + } + + @Override + public int hashCode() { + return Objects.hash(identityId, kind, value, identityStatus, linkedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LinkedIdentity {\n"); + sb.append(" identityId: ").append(toIndentedString(identityId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" identityStatus: ").append(toIndentedString(identityStatus)).append("\n"); + sb.append(" linkedAt: ").append(toIndentedString(linkedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/NextStep.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/NextStep.java new file mode 100644 index 0000000..b69546d --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/NextStep.java @@ -0,0 +1,220 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.net.URI; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * NextStep + */ +@JsonPropertyOrder({ + NextStep.JSON_PROPERTY_ACTION, + NextStep.JSON_PROPERTY_DESCRIPTION, + NextStep.JSON_PROPERTY_ENDPOINT, + NextStep.JSON_PROPERTY_ESTIMATED_TIME_MINUTES +}) +public class NextStep { + /** + * Gets or Sets action + */ + public enum ActionEnum { + CONFIGURE_DNS("CONFIGURE_DNS"), + + CONFIGURE_HTTP("CONFIGURE_HTTP"), + + VERIFY_DNS("VERIFY_DNS"), + + VALIDATE_DOMAIN("VALIDATE_DOMAIN"), + + WAIT("WAIT"), + + CANCEL("CANCEL"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ACTION = "action"; + + @Nullable + private ActionEnum action; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + + @Nullable + private String description; + + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + + @Nullable + private URI endpoint; + + public static final String JSON_PROPERTY_ESTIMATED_TIME_MINUTES = "estimatedTimeMinutes"; + + @Nullable + private Integer estimatedTimeMinutes; + + public NextStep() { + } + + public NextStep action(@Nullable ActionEnum action) { + this.action = action; + return this; + } + + /** + * Get action + * @return action + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_ACTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ActionEnum getAction() { + return action; + } + + @JsonProperty(value = JSON_PROPERTY_ACTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAction(@Nullable ActionEnum action) { + this.action = action; + } + + public NextStep description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + @JsonProperty(value = JSON_PROPERTY_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(@Nullable String description) { + this.description = description; + } + + public NextStep endpoint(@Nullable URI endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get endpoint + * @return endpoint + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public URI getEndpoint() { + return endpoint; + } + + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEndpoint(@Nullable URI endpoint) { + this.endpoint = endpoint; + } + + public NextStep estimatedTimeMinutes(@Nullable Integer estimatedTimeMinutes) { + this.estimatedTimeMinutes = estimatedTimeMinutes; + return this; + } + + /** + * Get estimatedTimeMinutes + * @return estimatedTimeMinutes + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_ESTIMATED_TIME_MINUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getEstimatedTimeMinutes() { + return estimatedTimeMinutes; + } + + @JsonProperty(value = JSON_PROPERTY_ESTIMATED_TIME_MINUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEstimatedTimeMinutes(@Nullable Integer estimatedTimeMinutes) { + this.estimatedTimeMinutes = estimatedTimeMinutes; + } + + /** + * Return true if this NextStep object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NextStep nextStep = (NextStep) o; + return Objects.equals(this.action, nextStep.action) && + Objects.equals(this.description, nextStep.description) && + Objects.equals(this.endpoint, nextStep.endpoint) && + Objects.equals(this.estimatedTimeMinutes, nextStep.estimatedTimeMinutes); + } + + @Override + public int hashCode() { + return Objects.hash(action, description, endpoint, estimatedTimeMinutes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NextStep {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); + sb.append(" estimatedTimeMinutes: ").append(toIndentedString(estimatedTimeMinutes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Problem.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Problem.java new file mode 100644 index 0000000..44bb273 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Problem.java @@ -0,0 +1,208 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * RFC 7807 Problem Details — the actual error shape every RA failure path emits, served as + * `application/problem+json`. Clients read `code` for programmatic handling and `detail` + * for the human-readable explanation. (The legacy `ErrorResponse` schema below is retained only for the + * pre-existing routes still declared against it; new routes point here. Migrating the remaining declarations is tracked + * separately.) + */ +@JsonPropertyOrder({ + Problem.JSON_PROPERTY_TYPE, + Problem.JSON_PROPERTY_TITLE, + Problem.JSON_PROPERTY_STATUS, + Problem.JSON_PROPERTY_DETAIL, + Problem.JSON_PROPERTY_CODE +}) +public class Problem { + public static final String JSON_PROPERTY_TYPE = "type"; + + @Nullable + private String type; + + public static final String JSON_PROPERTY_TITLE = "title"; + + @Nonnull + private String title; + + public static final String JSON_PROPERTY_STATUS = "status"; + + @Nonnull + private Integer status; + + public static final String JSON_PROPERTY_DETAIL = "detail"; + + @Nullable + private String detail; + + public static final String JSON_PROPERTY_CODE = "code"; + + @Nonnull + private String code; + + public Problem() { + } + + public Problem type(@Nullable String type) { + this.type = type; + return this; + } + + /** + * URI reference identifying the problem type. + * @return type + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@Nullable String type) { + this.type = type; + } + + public Problem title(@Nonnull String title) { + this.title = title; + return this; + } + + /** + * Short, human-readable summary of the problem type. + * @return title + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + @JsonProperty(value = JSON_PROPERTY_TITLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTitle(@Nonnull String title) { + this.title = title; + } + + public Problem status(@Nonnull Integer status) { + this.status = status; + return this; + } + + /** + * HTTP status code. + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull Integer status) { + this.status = status; + } + + public Problem detail(@Nullable String detail) { + this.detail = detail; + return this; + } + + /** + * Human-readable explanation specific to this occurrence. + * @return detail + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DETAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + @JsonProperty(value = JSON_PROPERTY_DETAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDetail(@Nullable String detail) { + this.detail = detail; + } + + public Problem code(@Nonnull String code) { + this.code = code; + return this; + } + + /** + * Stable, machine-readable error code for programmatic handling. + * @return code + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + @JsonProperty(value = JSON_PROPERTY_CODE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCode(@Nonnull String code) { + this.code = code; + } + + /** + * Return true if this Problem object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Problem problem = (Problem) o; + return Objects.equals(this.type, problem.type) && + Objects.equals(this.title, problem.title) && + Objects.equals(this.status, problem.status) && + Objects.equals(this.detail, problem.detail) && + Objects.equals(this.code, problem.code); + } + + @Override + public int hashCode() { + return Objects.hash(type, title, status, detail, code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Problem {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Protocol.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Protocol.java new file mode 100644 index 0000000..11dc346 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/Protocol.java @@ -0,0 +1,43 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets Protocol + */ +public enum Protocol { + + A2_A("A2A"), + + MCP("MCP"), + + HTTP_API("HTTP_API"); + + private String value; + + Protocol(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static Protocol fromValue(String value) { + for (Protocol b : Protocol.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RegistrationPending.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RegistrationPending.java new file mode 100644 index 0000000..1c622be --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RegistrationPending.java @@ -0,0 +1,374 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * RegistrationPending + */ +@JsonPropertyOrder({ + RegistrationPending.JSON_PROPERTY_AGENT_ID, + RegistrationPending.JSON_PROPERTY_STATUS, + RegistrationPending.JSON_PROPERTY_ANS_NAME, + RegistrationPending.JSON_PROPERTY_NEXT_STEPS, + RegistrationPending.JSON_PROPERTY_CHALLENGES, + RegistrationPending.JSON_PROPERTY_DNS_RECORDS, + RegistrationPending.JSON_PROPERTY_EXPIRES_AT, + RegistrationPending.JSON_PROPERTY_LINKS +}) +public class RegistrationPending { + public static final String JSON_PROPERTY_AGENT_ID = "agentId"; + + + @Nonnull + private UUID agentId; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING_VALIDATION("PENDING_VALIDATION"), + + PENDING_CERTS("PENDING_CERTS"), + + PENDING_DNS("PENDING_DNS"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_ANS_NAME = "ansName"; + + + @Nonnull + private String ansName; + + public static final String JSON_PROPERTY_NEXT_STEPS = "nextSteps"; + + + @Nonnull + private List nextSteps = new ArrayList<>(); + + public static final String JSON_PROPERTY_CHALLENGES = "challenges"; + + @Nullable + private List challenges = new ArrayList<>(); + + public static final String JSON_PROPERTY_DNS_RECORDS = "dnsRecords"; + + @Nullable + private List dnsRecords = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + @Nullable + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_LINKS = "links"; + + @Nullable + private List links = new ArrayList<>(); + + public RegistrationPending() { + } + + public RegistrationPending agentId(@Nonnull UUID agentId) { + this.agentId = agentId; + return this; + } + + /** + * Unique identifier assigned to this agent registration. Required for all subsequent API calls (verify-acme, verify-dns, certificates, revoke). New in v2 — previously callers had to parse this from HATEOAS link hrefs. Recommended for backport to v1. + * @return agentId + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAgentId() { + return agentId; + } + + @JsonProperty(value = JSON_PROPERTY_AGENT_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAgentId(@Nonnull UUID agentId) { + this.agentId = agentId; + } + + public RegistrationPending status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public RegistrationPending ansName(@Nonnull String ansName) { + this.ansName = ansName; + return this; + } + + /** + * Get ansName + * @return ansName + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAnsName() { + return ansName; + } + + @JsonProperty(value = JSON_PROPERTY_ANS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAnsName(@Nonnull String ansName) { + this.ansName = ansName; + } + + public RegistrationPending nextSteps(@Nonnull List nextSteps) { + this.nextSteps = nextSteps; + return this; + } + + public RegistrationPending addNextStepsItem(NextStep nextStepsItem) { + if (this.nextSteps == null) { + this.nextSteps = new ArrayList<>(); + } + this.nextSteps.add(nextStepsItem); + return this; + } + + /** + * Get nextSteps + * @return nextSteps + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NEXT_STEPS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getNextSteps() { + return nextSteps; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_STEPS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNextSteps(@Nonnull List nextSteps) { + this.nextSteps = nextSteps; + } + + public RegistrationPending challenges(@Nullable List challenges) { + this.challenges = challenges; + return this; + } + + public RegistrationPending addChallengesItem(ChallengeInfo challengesItem) { + if (this.challenges == null) { + this.challenges = new ArrayList<>(); + } + this.challenges.add(challengesItem); + return this; + } + + /** + * Get challenges + * @return challenges + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getChallenges() { + return challenges; + } + + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallenges(@Nullable List challenges) { + this.challenges = challenges; + } + + public RegistrationPending dnsRecords(@Nullable List dnsRecords) { + this.dnsRecords = dnsRecords; + return this; + } + + public RegistrationPending addDnsRecordsItem(DnsRecord dnsRecordsItem) { + if (this.dnsRecords == null) { + this.dnsRecords = new ArrayList<>(); + } + this.dnsRecords.add(dnsRecordsItem); + return this; + } + + /** + * Get dnsRecords + * @return dnsRecords + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DNS_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDnsRecords() { + return dnsRecords; + } + + @JsonProperty(value = JSON_PROPERTY_DNS_RECORDS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDnsRecords(@Nullable List dnsRecords) { + this.dnsRecords = dnsRecords; + } + + public RegistrationPending expiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExpiresAt(@Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public RegistrationPending links(@Nullable List links) { + this.links = links; + return this; + } + + public RegistrationPending addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LINKS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getLinks() { + return links; + } + + @JsonProperty(value = JSON_PROPERTY_LINKS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinks(@Nullable List links) { + this.links = links; + } + + /** + * Return true if this RegistrationPending object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RegistrationPending registrationPending = (RegistrationPending) o; + return Objects.equals(this.agentId, registrationPending.agentId) && + Objects.equals(this.status, registrationPending.status) && + Objects.equals(this.ansName, registrationPending.ansName) && + Objects.equals(this.nextSteps, registrationPending.nextSteps) && + Objects.equals(this.challenges, registrationPending.challenges) && + Objects.equals(this.dnsRecords, registrationPending.dnsRecords) && + Objects.equals(this.expiresAt, registrationPending.expiresAt) && + Objects.equals(this.links, registrationPending.links); + } + + @Override + public int hashCode() { + return Objects.hash(agentId, status, ansName, nextSteps, challenges, dnsRecords, expiresAt, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RegistrationPending {\n"); + sb.append(" agentId: ").append(toIndentedString(agentId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" ansName: ").append(toIndentedString(ansName)).append("\n"); + sb.append(" nextSteps: ").append(toIndentedString(nextSteps)).append("\n"); + sb.append(" challenges: ").append(toIndentedString(challenges)).append("\n"); + sb.append(" dnsRecords: ").append(toIndentedString(dnsRecords)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalStatusResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalStatusResponse.java new file mode 100644 index 0000000..5844ec0 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalStatusResponse.java @@ -0,0 +1,379 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * RenewalStatusResponse + */ +@JsonPropertyOrder({ + RenewalStatusResponse.JSON_PROPERTY_RENEWAL_TYPE, + RenewalStatusResponse.JSON_PROPERTY_STATUS, + RenewalStatusResponse.JSON_PROPERTY_CSR_ID, + RenewalStatusResponse.JSON_PROPERTY_CHALLENGES, + RenewalStatusResponse.JSON_PROPERTY_TLSA_DNS_RECORD, + RenewalStatusResponse.JSON_PROPERTY_FAILURE_REASON, + RenewalStatusResponse.JSON_PROPERTY_EXPIRES_AT, + RenewalStatusResponse.JSON_PROPERTY_NEXT_STEP +}) +public class RenewalStatusResponse { + /** + * Gets or Sets renewalType + */ + public enum RenewalTypeEnum { + SERVER_CSR("SERVER_CSR"), + + SERVER_BYOC("SERVER_BYOC"); + + private String value; + + RenewalTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static RenewalTypeEnum fromValue(String value) { + for (RenewalTypeEnum b : RenewalTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_RENEWAL_TYPE = "renewalType"; + + + @Nonnull + private RenewalTypeEnum renewalType; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING_VALIDATION("PENDING_VALIDATION"), + + ISSUING_CERTIFICATE("ISSUING_CERTIFICATE"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + EXPIRED("EXPIRED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + + @Nullable + private UUID csrId; + + public static final String JSON_PROPERTY_CHALLENGES = "challenges"; + + @Nullable + private RenewalSubmissionResponseChallenges challenges; + + public static final String JSON_PROPERTY_TLSA_DNS_RECORD = "tlsaDnsRecord"; + + @Nullable + private DnsRecord tlsaDnsRecord; + + public static final String JSON_PROPERTY_FAILURE_REASON = "failureReason"; + + @Nullable + private String failureReason; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + + @Nonnull + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_NEXT_STEP = "nextStep"; + + + @Nonnull + private NextStep nextStep; + + public RenewalStatusResponse() { + } + + public RenewalStatusResponse renewalType(@Nonnull RenewalTypeEnum renewalType) { + this.renewalType = renewalType; + return this; + } + + /** + * Get renewalType + * @return renewalType + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_RENEWAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RenewalTypeEnum getRenewalType() { + return renewalType; + } + + @JsonProperty(value = JSON_PROPERTY_RENEWAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRenewalType(@Nonnull RenewalTypeEnum renewalType) { + this.renewalType = renewalType; + } + + public RenewalStatusResponse status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public RenewalStatusResponse csrId(@Nullable UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCsrId(@Nullable UUID csrId) { + this.csrId = csrId; + } + + public RenewalStatusResponse challenges(@Nullable RenewalSubmissionResponseChallenges challenges) { + this.challenges = challenges; + return this; + } + + /** + * Get challenges + * @return challenges + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RenewalSubmissionResponseChallenges getChallenges() { + return challenges; + } + + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallenges(@Nullable RenewalSubmissionResponseChallenges challenges) { + this.challenges = challenges; + } + + public RenewalStatusResponse tlsaDnsRecord(@Nullable DnsRecord tlsaDnsRecord) { + this.tlsaDnsRecord = tlsaDnsRecord; + return this; + } + + /** + * Get tlsaDnsRecord + * @return tlsaDnsRecord + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TLSA_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DnsRecord getTlsaDnsRecord() { + return tlsaDnsRecord; + } + + @JsonProperty(value = JSON_PROPERTY_TLSA_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTlsaDnsRecord(@Nullable DnsRecord tlsaDnsRecord) { + this.tlsaDnsRecord = tlsaDnsRecord; + } + + public RenewalStatusResponse failureReason(@Nullable String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Get failureReason + * @return failureReason + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_FAILURE_REASON, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFailureReason() { + return failureReason; + } + + @JsonProperty(value = JSON_PROPERTY_FAILURE_REASON, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFailureReason(@Nullable String failureReason) { + this.failureReason = failureReason; + } + + public RenewalStatusResponse expiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setExpiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public RenewalStatusResponse nextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + return this; + } + + /** + * Get nextStep + * @return nextStep + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NextStep getNextStep() { + return nextStep; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + } + + /** + * Return true if this RenewalStatusResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenewalStatusResponse renewalStatusResponse = (RenewalStatusResponse) o; + return Objects.equals(this.renewalType, renewalStatusResponse.renewalType) && + Objects.equals(this.status, renewalStatusResponse.status) && + Objects.equals(this.csrId, renewalStatusResponse.csrId) && + Objects.equals(this.challenges, renewalStatusResponse.challenges) && + Objects.equals(this.tlsaDnsRecord, renewalStatusResponse.tlsaDnsRecord) && + Objects.equals(this.failureReason, renewalStatusResponse.failureReason) && + Objects.equals(this.expiresAt, renewalStatusResponse.expiresAt) && + Objects.equals(this.nextStep, renewalStatusResponse.nextStep); + } + + @Override + public int hashCode() { + return Objects.hash(renewalType, status, csrId, challenges, tlsaDnsRecord, failureReason, expiresAt, nextStep); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenewalStatusResponse {\n"); + sb.append(" renewalType: ").append(toIndentedString(renewalType)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" challenges: ").append(toIndentedString(challenges)).append("\n"); + sb.append(" tlsaDnsRecord: ").append(toIndentedString(tlsaDnsRecord)).append("\n"); + sb.append(" failureReason: ").append(toIndentedString(failureReason)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" nextStep: ").append(toIndentedString(nextStep)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponse.java new file mode 100644 index 0000000..55a9bec --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponse.java @@ -0,0 +1,353 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * RenewalSubmissionResponse + */ +@JsonPropertyOrder({ + RenewalSubmissionResponse.JSON_PROPERTY_RENEWAL_TYPE, + RenewalSubmissionResponse.JSON_PROPERTY_STATUS, + RenewalSubmissionResponse.JSON_PROPERTY_CSR_ID, + RenewalSubmissionResponse.JSON_PROPERTY_CHALLENGES, + RenewalSubmissionResponse.JSON_PROPERTY_EXPIRES_AT, + RenewalSubmissionResponse.JSON_PROPERTY_NEXT_STEP, + RenewalSubmissionResponse.JSON_PROPERTY_LINKS +}) +public class RenewalSubmissionResponse { + /** + * Gets or Sets renewalType + */ + public enum RenewalTypeEnum { + SERVER_CSR("SERVER_CSR"), + + SERVER_BYOC("SERVER_BYOC"); + + private String value; + + RenewalTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static RenewalTypeEnum fromValue(String value) { + for (RenewalTypeEnum b : RenewalTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_RENEWAL_TYPE = "renewalType"; + + + @Nonnull + private RenewalTypeEnum renewalType; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING_VALIDATION("PENDING_VALIDATION"), + + ISSUING_CERTIFICATE("ISSUING_CERTIFICATE"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + + @Nullable + private UUID csrId; + + public static final String JSON_PROPERTY_CHALLENGES = "challenges"; + + @Nullable + private RenewalSubmissionResponseChallenges challenges; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt"; + + + @Nonnull + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_NEXT_STEP = "nextStep"; + + + @Nonnull + private NextStep nextStep; + + public static final String JSON_PROPERTY_LINKS = "links"; + + @Nullable + private List links = new ArrayList<>(); + + public RenewalSubmissionResponse() { + } + + public RenewalSubmissionResponse renewalType(@Nonnull RenewalTypeEnum renewalType) { + this.renewalType = renewalType; + return this; + } + + /** + * Get renewalType + * @return renewalType + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_RENEWAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RenewalTypeEnum getRenewalType() { + return renewalType; + } + + @JsonProperty(value = JSON_PROPERTY_RENEWAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRenewalType(@Nonnull RenewalTypeEnum renewalType) { + this.renewalType = renewalType; + } + + public RenewalSubmissionResponse status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public RenewalSubmissionResponse csrId(@Nullable UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCsrId(@Nullable UUID csrId) { + this.csrId = csrId; + } + + public RenewalSubmissionResponse challenges(@Nullable RenewalSubmissionResponseChallenges challenges) { + this.challenges = challenges; + return this; + } + + /** + * Get challenges + * @return challenges + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RenewalSubmissionResponseChallenges getChallenges() { + return challenges; + } + + @JsonProperty(value = JSON_PROPERTY_CHALLENGES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChallenges(@Nullable RenewalSubmissionResponseChallenges challenges) { + this.challenges = challenges; + } + + public RenewalSubmissionResponse expiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + @JsonProperty(value = JSON_PROPERTY_EXPIRES_AT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setExpiresAt(@Nonnull OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public RenewalSubmissionResponse nextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + return this; + } + + /** + * Get nextStep + * @return nextStep + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NextStep getNextStep() { + return nextStep; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + } + + public RenewalSubmissionResponse links(@Nullable List links) { + this.links = links; + return this; + } + + public RenewalSubmissionResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_LINKS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getLinks() { + return links; + } + + @JsonProperty(value = JSON_PROPERTY_LINKS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinks(@Nullable List links) { + this.links = links; + } + + /** + * Return true if this RenewalSubmissionResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenewalSubmissionResponse renewalSubmissionResponse = (RenewalSubmissionResponse) o; + return Objects.equals(this.renewalType, renewalSubmissionResponse.renewalType) && + Objects.equals(this.status, renewalSubmissionResponse.status) && + Objects.equals(this.csrId, renewalSubmissionResponse.csrId) && + Objects.equals(this.challenges, renewalSubmissionResponse.challenges) && + Objects.equals(this.expiresAt, renewalSubmissionResponse.expiresAt) && + Objects.equals(this.nextStep, renewalSubmissionResponse.nextStep) && + Objects.equals(this.links, renewalSubmissionResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(renewalType, status, csrId, challenges, expiresAt, nextStep, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenewalSubmissionResponse {\n"); + sb.append(" renewalType: ").append(toIndentedString(renewalType)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" challenges: ").append(toIndentedString(challenges)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" nextStep: ").append(toIndentedString(nextStep)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallenges.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallenges.java new file mode 100644 index 0000000..a4ebf87 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallenges.java @@ -0,0 +1,118 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import jakarta.annotation.Nullable; + +/** + * RenewalSubmissionResponseChallenges + */ +@JsonPropertyOrder({ + RenewalSubmissionResponseChallenges.JSON_PROPERTY_DNS01, + RenewalSubmissionResponseChallenges.JSON_PROPERTY_HTTP01 +}) +public class RenewalSubmissionResponseChallenges { + public static final String JSON_PROPERTY_DNS01 = "dns01"; + + @Nullable + private ChallengeInfo dns01; + + public static final String JSON_PROPERTY_HTTP01 = "http01"; + + @Nullable + private ChallengeInfo http01; + + public RenewalSubmissionResponseChallenges() { + } + + public RenewalSubmissionResponseChallenges dns01(@Nullable ChallengeInfo dns01) { + this.dns01 = dns01; + return this; + } + + /** + * Get dns01 + * + * @return dns01 + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_DNS01, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChallengeInfo getDns01() { + return dns01; + } + + @JsonProperty(value = JSON_PROPERTY_DNS01, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDns01(@Nullable ChallengeInfo dns01) { + this.dns01 = dns01; + } + + public RenewalSubmissionResponseChallenges http01(@Nullable ChallengeInfo http01) { + this.http01 = http01; + return this; + } + + /** + * Get http01 + * + * @return http01 + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_HTTP01, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChallengeInfo getHttp01() { + return http01; + } + + @JsonProperty(value = JSON_PROPERTY_HTTP01, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHttp01(@Nullable ChallengeInfo http01) { + this.http01 = http01; + } + + /** + * Return true if this RenewalSubmissionResponse_challenges object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenewalSubmissionResponseChallenges renewalSubmissionResponseChallenges = + (RenewalSubmissionResponseChallenges) o; + return Objects.equals(this.dns01, renewalSubmissionResponseChallenges.dns01) && + Objects.equals(this.http01, renewalSubmissionResponseChallenges.http01); + } + + @Override + public int hashCode() { + return Objects.hash(dns01, http01); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenewalSubmissionResponseChallenges {\n"); + sb.append(" dns01: ").append(toIndentedString(dns01)).append("\n"); + sb.append(" http01: ").append(toIndentedString(http01)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalVerificationResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalVerificationResponse.java new file mode 100644 index 0000000..a4bee88 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RenewalVerificationResponse.java @@ -0,0 +1,217 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; + +/** + * RenewalVerificationResponse + */ +@JsonPropertyOrder({ + RenewalVerificationResponse.JSON_PROPERTY_STATUS, + RenewalVerificationResponse.JSON_PROPERTY_CSR_ID, + RenewalVerificationResponse.JSON_PROPERTY_TLSA_DNS_RECORD, + RenewalVerificationResponse.JSON_PROPERTY_NEXT_STEP +}) +public class RenewalVerificationResponse { + /** + * Gets or Sets status + */ + public enum StatusEnum { + VERIFIED("VERIFIED"), + + ISSUING_CERTIFICATE("ISSUING_CERTIFICATE"), + + COMPLETED("COMPLETED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + + + @Nonnull + private StatusEnum status; + + public static final String JSON_PROPERTY_CSR_ID = "csrId"; + + @Nullable + private UUID csrId; + + public static final String JSON_PROPERTY_TLSA_DNS_RECORD = "tlsaDnsRecord"; + + @Nullable + private DnsRecord tlsaDnsRecord; + + public static final String JSON_PROPERTY_NEXT_STEP = "nextStep"; + + + @Nonnull + private NextStep nextStep; + + public RenewalVerificationResponse() { + } + + public RenewalVerificationResponse status(@Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@Nonnull StatusEnum status) { + this.status = status; + } + + public RenewalVerificationResponse csrId(@Nullable UUID csrId) { + this.csrId = csrId; + return this; + } + + /** + * Get csrId + * @return csrId + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getCsrId() { + return csrId; + } + + @JsonProperty(value = JSON_PROPERTY_CSR_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCsrId(@Nullable UUID csrId) { + this.csrId = csrId; + } + + public RenewalVerificationResponse tlsaDnsRecord(@Nullable DnsRecord tlsaDnsRecord) { + this.tlsaDnsRecord = tlsaDnsRecord; + return this; + } + + /** + * Get tlsaDnsRecord + * @return tlsaDnsRecord + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_TLSA_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DnsRecord getTlsaDnsRecord() { + return tlsaDnsRecord; + } + + @JsonProperty(value = JSON_PROPERTY_TLSA_DNS_RECORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTlsaDnsRecord(@Nullable DnsRecord tlsaDnsRecord) { + this.tlsaDnsRecord = tlsaDnsRecord; + } + + public RenewalVerificationResponse nextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + return this; + } + + /** + * Get nextStep + * @return nextStep + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NextStep getNextStep() { + return nextStep; + } + + @JsonProperty(value = JSON_PROPERTY_NEXT_STEP, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNextStep(@Nonnull NextStep nextStep) { + this.nextStep = nextStep; + } + + /** + * Return true if this RenewalVerificationResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenewalVerificationResponse renewalVerificationResponse = (RenewalVerificationResponse) o; + return Objects.equals(this.status, renewalVerificationResponse.status) && + Objects.equals(this.csrId, renewalVerificationResponse.csrId) && + Objects.equals(this.tlsaDnsRecord, renewalVerificationResponse.tlsaDnsRecord) && + Objects.equals(this.nextStep, renewalVerificationResponse.nextStep); + } + + @Override + public int hashCode() { + return Objects.hash(status, csrId, tlsaDnsRecord, nextStep); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenewalVerificationResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" csrId: ").append(toIndentedString(csrId)).append("\n"); + sb.append(" tlsaDnsRecord: ").append(toIndentedString(tlsaDnsRecord)).append("\n"); + sb.append(" nextStep: ").append(toIndentedString(nextStep)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RevocationReason.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RevocationReason.java new file mode 100644 index 0000000..16c1a9d --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/RevocationReason.java @@ -0,0 +1,51 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets RevocationReason + */ +public enum RevocationReason { + + KEY_COMPROMISE("KEY_COMPROMISE"), + + CESSATION_OF_OPERATION("CESSATION_OF_OPERATION"), + + AFFILIATION_CHANGED("AFFILIATION_CHANGED"), + + SUPERSEDED("SUPERSEDED"), + + CERTIFICATE_HOLD("CERTIFICATE_HOLD"), + + PRIVILEGE_WITHDRAWN("PRIVILEGE_WITHDRAWN"), + + AA_COMPROMISE("AA_COMPROMISE"); + + private String value; + + RevocationReason(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static RevocationReason fromValue(String value) { + for (RevocationReason b : RevocationReason.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequest.java new file mode 100644 index 0000000..d142163 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequest.java @@ -0,0 +1,144 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * ServerCertificateRenewalRequest + */ +@JsonPropertyOrder({ + ServerCertificateRenewalRequest.JSON_PROPERTY_SERVER_CSR_P_E_M, + ServerCertificateRenewalRequest.JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, + ServerCertificateRenewalRequest.JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M +}) +public class ServerCertificateRenewalRequest { + public static final String JSON_PROPERTY_SERVER_CSR_P_E_M = "serverCsrPEM"; + + @Nullable + private String serverCsrPEM; + + public static final String JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M = "serverCertificatePEM"; + + @Nullable + private String serverCertificatePEM; + + public static final String JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M = "serverCertificateChainPEM"; + + @Nullable + private String serverCertificateChainPEM; + + public ServerCertificateRenewalRequest() { + } + + public ServerCertificateRenewalRequest serverCsrPEM(@Nullable String serverCsrPEM) { + this.serverCsrPEM = serverCsrPEM; + return this; + } + + /** + * Get serverCsrPEM + * @return serverCsrPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCsrPEM() { + return serverCsrPEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CSR_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCsrPEM(@Nullable String serverCsrPEM) { + this.serverCsrPEM = serverCsrPEM; + } + + public ServerCertificateRenewalRequest serverCertificatePEM(@Nullable String serverCertificatePEM) { + this.serverCertificatePEM = serverCertificatePEM; + return this; + } + + /** + * Get serverCertificatePEM + * @return serverCertificatePEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCertificatePEM() { + return serverCertificatePEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCertificatePEM(@Nullable String serverCertificatePEM) { + this.serverCertificatePEM = serverCertificatePEM; + } + + public ServerCertificateRenewalRequest serverCertificateChainPEM(@Nullable String serverCertificateChainPEM) { + this.serverCertificateChainPEM = serverCertificateChainPEM; + return this; + } + + /** + * Get serverCertificateChainPEM + * @return serverCertificateChainPEM + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerCertificateChainPEM() { + return serverCertificateChainPEM; + } + + @JsonProperty(value = JSON_PROPERTY_SERVER_CERTIFICATE_CHAIN_P_E_M, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServerCertificateChainPEM(@Nullable String serverCertificateChainPEM) { + this.serverCertificateChainPEM = serverCertificateChainPEM; + } + + /** + * Return true if this ServerCertificateRenewalRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServerCertificateRenewalRequest serverCertificateRenewalRequest = (ServerCertificateRenewalRequest) o; + return Objects.equals(this.serverCsrPEM, serverCertificateRenewalRequest.serverCsrPEM) && + Objects.equals(this.serverCertificatePEM, serverCertificateRenewalRequest.serverCertificatePEM) && + Objects.equals(this.serverCertificateChainPEM, + serverCertificateRenewalRequest.serverCertificateChainPEM); + } + + @Override + public int hashCode() { + return Objects.hash(serverCsrPEM, serverCertificatePEM, serverCertificateChainPEM); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerCertificateRenewalRequest {\n"); + sb.append(" serverCsrPEM: ").append(toIndentedString(serverCsrPEM)).append("\n"); + sb.append(" serverCertificatePEM: ").append(toIndentedString(serverCertificatePEM)).append("\n"); + sb.append(" serverCertificateChainPEM: ").append(toIndentedString(serverCertificateChainPEM)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VLEIPresentation.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VLEIPresentation.java new file mode 100644 index 0000000..93a78f3 --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VLEIPresentation.java @@ -0,0 +1,88 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nonnull; + +/** + * The lei (vLEI) register-time credential presentation. REQUIRED for the `lei` kind and omitted for the JWS + * kinds (`did:web`, `did:key`). The RA submits the CESR to its configured vlei-verifier, which + * derives and pins the subject AID; the 202's `presentationStatus` reports the verifier's advisory + * authorization decision. + */ +@JsonPropertyOrder({ + VLEIPresentation.JSON_PROPERTY_CESR +}) +public class VLEIPresentation { + public static final String JSON_PROPERTY_CESR = "cesr"; + + @Nonnull + private String cesr; + + public VLEIPresentation() { + } + + public VLEIPresentation cesr(@Nonnull String cesr) { + this.cesr = cesr; + return this; + } + + /** + * The full-chain CESR export of the vLEI credential and its supporting KELs/ACDCs (the `credentials() + * .get(said, true)` shape). The RA never parses KERI key state itself — the verifier is the authoritative + * key-state oracle. + * @return cesr + */ + @Nonnull + @JsonProperty(value = JSON_PROPERTY_CESR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCesr() { + return cesr; + } + + @JsonProperty(value = JSON_PROPERTY_CESR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCesr(@Nonnull String cesr) { + this.cesr = cesr; + } + + /** + * Return true if this VLEIPresentation object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VLEIPresentation vlEIPresentation = (VLEIPresentation) o; + return Objects.equals(this.cesr, vlEIPresentation.cesr); + } + + @Override + public int hashCode() { + return Objects.hash(cesr); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VLEIPresentation {\n"); + sb.append(" cesr: ").append(toIndentedString(cesr)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VerifyControlRequest.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VerifyControlRequest.java new file mode 100644 index 0000000..4602d2a --- /dev/null +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/VerifyControlRequest.java @@ -0,0 +1,132 @@ +package com.godaddy.ans.sdk.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.annotation.Nullable; + +/** + * The control proof. Its members are additive per identifier kind, and EXACTLY ONE family is set per request: + * - JWS kinds (`did:web`, `did:key`) submit `signedProofs` — one compact JWS per + * proven key. - The `lei` kind submits `cesrSignature` — a single CESR signature over the + * served signingInput by the subject AID's current key. Supported JWS algorithms match what the verifier + * implements: EdDSA (Ed25519), ES256 (ECDSA P-256), and RS256 (RSA >= 2048). Key-agreement keys (X25519) and + * curves without a verifier (secp256k1, P-384/521) are rejected with a precise error. + */ +@JsonPropertyOrder({ + VerifyControlRequest.JSON_PROPERTY_SIGNED_PROOFS, + VerifyControlRequest.JSON_PROPERTY_CESR_SIGNATURE +}) +public class VerifyControlRequest { + public static final String JSON_PROPERTY_SIGNED_PROOFS = "signedProofs"; + + @Nullable + private List signedProofs = new ArrayList<>(); + + public static final String JSON_PROPERTY_CESR_SIGNATURE = "cesrSignature"; + + @Nullable + private String cesrSignature; + + public VerifyControlRequest() { + } + + public VerifyControlRequest signedProofs(@Nullable List signedProofs) { + this.signedProofs = signedProofs; + return this; + } + + public VerifyControlRequest addSignedProofsItem(String signedProofsItem) { + if (this.signedProofs == null) { + this.signedProofs = new ArrayList<>(); + } + this.signedProofs.add(signedProofsItem); + return this; + } + + /** + * Get signedProofs + * @return signedProofs + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_SIGNED_PROOFS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getSignedProofs() { + return signedProofs; + } + + @JsonProperty(value = JSON_PROPERTY_SIGNED_PROOFS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSignedProofs(@Nullable List signedProofs) { + this.signedProofs = signedProofs; + } + + public VerifyControlRequest cesrSignature(@Nullable String cesrSignature) { + this.cesrSignature = cesrSignature; + return this; + } + + /** + * The lei proof: a single CESR signature over the served signingInput by the subject AID's current key. Set + * only for the `lei` kind. The RA forwards it to the vlei-verifier, which resolves the AID's key + * state from its KEL and checks the signature over the exact signingInput bytes (the same payload the JWS kinds + * sign). + * @return cesrSignature + */ + @Nullable + @JsonProperty(value = JSON_PROPERTY_CESR_SIGNATURE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCesrSignature() { + return cesrSignature; + } + + @JsonProperty(value = JSON_PROPERTY_CESR_SIGNATURE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCesrSignature(@Nullable String cesrSignature) { + this.cesrSignature = cesrSignature; + } + + /** + * Return true if this VerifyControlRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyControlRequest verifyControlRequest = (VerifyControlRequest) o; + return Objects.equals(this.signedProofs, verifyControlRequest.signedProofs) && + Objects.equals(this.cesrSignature, verifyControlRequest.cesrSignature); + } + + @Override + public int hashCode() { + return Objects.hash(signedProofs, cesrSignature); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyControlRequest {\n"); + sb.append(" signedProofs: ").append(toIndentedString(signedProofs)).append("\n"); + sb.append(" cesrSignature: ").append(toIndentedString(cesrSignature)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentDetailsTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentDetailsTest.java new file mode 100644 index 0000000..c75f548 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentDetailsTest.java @@ -0,0 +1,85 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class AgentDetailsTest { + + private static AgentDetails populated() { + return new AgentDetails() + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .agentDisplayName("x") + .agentDescription("x") + .version("x") + .agentHost("x") + .endpoints(List.of(new AgentEndpoint())) + .ansName("x") + .agentStatus(AgentLifecycleStatus.PENDING_VALIDATION) + .registrationTimestamp(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .lastRenewalTimestamp(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .registrationPending(new RegistrationPending()) + .links(List.of(new Link())) + .identities(List.of(new LinkedIdentity())); + } + + @Test + void gettersReflectFluentSetters() { + AgentDetails a = populated(); + AgentDetails b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentDetails a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentDetails()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentDetails"); + assertThat(new AgentDetails().toString()).contains("class AgentDetails"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentDetails a = populated(); + String json = mapper.writeValueAsString(a); + AgentDetails back = mapper.readValue(json, AgentDetails.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEndpointsInitialisesList() { + AgentDetails o = new AgentDetails(); + o.setEndpoints(null); + o.addEndpointsItem(new AgentEndpoint()); + assertThat(o.getEndpoints()).hasSize(1); + } + + @Test + void addLinkInitialisesList() { + AgentDetails o = new AgentDetails(); + o.setLinks(null); + o.addLinksItem(new Link()); + assertThat(o.getLinks()).hasSize(1); + } + + @Test + void addIdentityInitialisesList() { + AgentDetails o = new AgentDetails(); + o.setIdentities(null); + o.addIdentitiesItem(new LinkedIdentity()); + assertThat(o.getIdentities()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentEndpointTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentEndpointTest.java new file mode 100644 index 0000000..2a8e1c3 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentEndpointTest.java @@ -0,0 +1,77 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class AgentEndpointTest { + + private static AgentEndpoint populated() { + return new AgentEndpoint() + .agentUrl(URI.create("https://example.com/x")) + .metaDataUrl(URI.create("https://example.com/x")) + .metaDataHash("x") + .documentationUrl(URI.create("https://example.com/x")) + .protocol(Protocol.A2_A) + .functions(List.of(new AgentFunction())) + .transports(List.of(AgentEndpoint.TransportsEnum.STREAMABLE_HTTP)); + } + + @Test + void gettersReflectFluentSetters() { + AgentEndpoint a = populated(); + AgentEndpoint b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentEndpoint a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentEndpoint()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentEndpoint"); + assertThat(new AgentEndpoint().toString()).contains("class AgentEndpoint"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentEndpoint a = populated(); + String json = mapper.writeValueAsString(a); + AgentEndpoint back = mapper.readValue(json, AgentEndpoint.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addFunctionsItemInitialiseList() { + AgentEndpoint o = new AgentEndpoint(); + o.setFunctions(null); + o.addFunctionsItem(new AgentFunction()); + assertThat(o.getFunctions()).hasSize(1); + } + + @Test + void addTransportsItemInitialiseListTransports() { + AgentEndpoint o = new AgentEndpoint(); + o.setTransports(null); + o.addTransportsItem(AgentEndpoint.TransportsEnum.STREAMABLE_HTTP); + assertThat(o.getTransports()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> AgentEndpoint.TransportsEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentFunctionTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentFunctionTest.java new file mode 100644 index 0000000..98b3fc7 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentFunctionTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class AgentFunctionTest { + + private static AgentFunction populated() { + return new AgentFunction() + .id("x") + .name("x") + .tags(List.of("x")); + } + + @Test + void gettersReflectFluentSetters() { + AgentFunction a = populated(); + AgentFunction b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentFunction a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentFunction()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentFunction"); + assertThat(new AgentFunction().toString()).contains("class AgentFunction"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentFunction a = populated(); + String json = mapper.writeValueAsString(a); + AgentFunction back = mapper.readValue(json, AgentFunction.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addTagsItemInitialiseList() { + AgentFunction o = new AgentFunction(); + o.setTags(null); + o.addTagsItem("x"); + assertThat(o.getTags()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilterTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilterTest.java new file mode 100644 index 0000000..ba2c5e8 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusFilterTest.java @@ -0,0 +1,30 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class AgentLifecycleStatusFilterTest { + + @Test + void valuesAndGetValue() { + assertThat(AgentLifecycleStatusFilter.values()).hasSize(5); + assertThat(AgentLifecycleStatusFilter.ALL.getValue()).isEqualTo("ALL"); + } + + @Test + void fromValueRoundTrip() { + for (AgentLifecycleStatusFilter s : AgentLifecycleStatusFilter.values()) { + assertThat(AgentLifecycleStatusFilter.fromValue(s.getValue())).isEqualTo(s); + assertThat(s.toString()).isEqualTo(s.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> AgentLifecycleStatusFilter.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusTest.java new file mode 100644 index 0000000..e333084 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentLifecycleStatusTest.java @@ -0,0 +1,30 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class AgentLifecycleStatusTest { + + @Test + void valuesAndGetValue() { + assertThat(AgentLifecycleStatus.values()).hasSize(7); + assertThat(AgentLifecycleStatus.ACTIVE.getValue()).isEqualTo("ACTIVE"); + } + + @Test + void fromValueRoundTrip() { + for (AgentLifecycleStatus s : AgentLifecycleStatus.values()) { + assertThat(AgentLifecycleStatus.fromValue(s.getValue())).isEqualTo(s); + assertThat(s.toString()).isEqualTo(s.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> AgentLifecycleStatus.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInnerTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInnerTest.java new file mode 100644 index 0000000..aa63c79 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseItemsInnerTest.java @@ -0,0 +1,75 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class AgentListResponseItemsInnerTest { + + private static AgentListResponseItemsInner populated() { + return new AgentListResponseItemsInner() + .ansName("x") + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .agentDisplayName("x") + .agentDescription("x") + .version("x") + .agentHost("x") + .status(AgentLifecycleStatus.PENDING_VALIDATION) + .ttl(1) + .registrationTimestamp(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .endpoints(List.of(new AgentEndpoint())) + .links(List.of(new Link())); + } + + @Test + void gettersReflectFluentSetters() { + AgentListResponseItemsInner a = populated(); + AgentListResponseItemsInner b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentListResponseItemsInner a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentListResponseItemsInner()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentListResponseItemsInner"); + assertThat(new AgentListResponseItemsInner().toString()).contains("class AgentListResponseItemsInner"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentListResponseItemsInner a = populated(); + String json = mapper.writeValueAsString(a); + AgentListResponseItemsInner back = mapper.readValue(json, AgentListResponseItemsInner.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEndpointsItemInitialiseList() { + AgentListResponseItemsInner o = new AgentListResponseItemsInner(); + o.setEndpoints(null); + o.addEndpointsItem(new AgentEndpoint()); + assertThat(o.getEndpoints()).hasSize(1); + } + + @Test + void addLinksItemInitialiseList() { + AgentListResponseItemsInner o = new AgentListResponseItemsInner(); + o.setLinks(null); + o.addLinksItem(new Link()); + assertThat(o.getLinks()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseTest.java new file mode 100644 index 0000000..720da57 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentListResponseTest.java @@ -0,0 +1,59 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class AgentListResponseTest { + + private static AgentListResponse populated() { + return new AgentListResponse() + .items(List.of(new AgentListResponseItemsInner())) + .returnedCount(1) + .limit(1) + .nextCursor("x") + .hasMore(true); + } + + @Test + void gettersReflectFluentSetters() { + AgentListResponse a = populated(); + AgentListResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentListResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentListResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentListResponse"); + assertThat(new AgentListResponse().toString()).contains("class AgentListResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentListResponse a = populated(); + String json = mapper.writeValueAsString(a); + AgentListResponse back = mapper.readValue(json, AgentListResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addItemsItemInitialiseList() { + AgentListResponse o = new AgentListResponse(); + o.setItems(null); + o.addItemsItem(new AgentListResponseItemsInner()); + assertThat(o.getItems()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRegistrationRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRegistrationRequestTest.java new file mode 100644 index 0000000..59b230e --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRegistrationRequestTest.java @@ -0,0 +1,65 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; +import java.util.Set; + +import org.junit.jupiter.api.Test; + +class AgentRegistrationRequestTest { + + private static AgentRegistrationRequest populated() { + return new AgentRegistrationRequest() + .agentDisplayName("x") + .agentDescription("x") + .version("x") + .agentHost("x") + .endpoints(List.of(new AgentEndpoint())) + .serverCsrPEM("x") + .serverCertificatePEM("x") + .serverCertificateChainPEM("x") + .identityCsrPEM("x") + .discoveryProfiles(Set.of(DiscoveryProfile.ANS_DNSAID)); + } + + @Test + void gettersReflectFluentSetters() { + AgentRegistrationRequest a = populated(); + AgentRegistrationRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentRegistrationRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentRegistrationRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentRegistrationRequest"); + assertThat(new AgentRegistrationRequest().toString()).contains("class AgentRegistrationRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentRegistrationRequest a = populated(); + String json = mapper.writeValueAsString(a); + AgentRegistrationRequest back = mapper.readValue(json, AgentRegistrationRequest.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEndpointsItemInitialiseList() { + AgentRegistrationRequest o = new AgentRegistrationRequest(); + o.setEndpoints(null); + o.addEndpointsItem(new AgentEndpoint()); + assertThat(o.getEndpoints()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationRequestTest.java new file mode 100644 index 0000000..23d0418 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationRequestTest.java @@ -0,0 +1,46 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class AgentRevocationRequestTest { + + private static AgentRevocationRequest populated() { + return new AgentRevocationRequest() + .reason(RevocationReason.KEY_COMPROMISE) + .comments("x"); + } + + @Test + void gettersReflectFluentSetters() { + AgentRevocationRequest a = populated(); + AgentRevocationRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentRevocationRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentRevocationRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentRevocationRequest"); + assertThat(new AgentRevocationRequest().toString()).contains("class AgentRevocationRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentRevocationRequest a = populated(); + String json = mapper.writeValueAsString(a); + AgentRevocationRequest back = mapper.readValue(json, AgentRevocationRequest.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationResponseTest.java new file mode 100644 index 0000000..6ab4413 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentRevocationResponseTest.java @@ -0,0 +1,71 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class AgentRevocationResponseTest { + + private static AgentRevocationResponse populated() { + return new AgentRevocationResponse() + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .ansName("x") + .status(AgentLifecycleStatus.PENDING_VALIDATION) + .revokedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .reason(RevocationReason.KEY_COMPROMISE) + .dnsRecordsToRemove(List.of(new DnsRecord())) + .links(List.of(new Link())); + } + + @Test + void gettersReflectFluentSetters() { + AgentRevocationResponse a = populated(); + AgentRevocationResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentRevocationResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentRevocationResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentRevocationResponse"); + assertThat(new AgentRevocationResponse().toString()).contains("class AgentRevocationResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentRevocationResponse a = populated(); + String json = mapper.writeValueAsString(a); + AgentRevocationResponse back = mapper.readValue(json, AgentRevocationResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addDnsRecordsToRemoveItemInitialiseList() { + AgentRevocationResponse o = new AgentRevocationResponse(); + o.setDnsRecordsToRemove(null); + o.addDnsRecordsToRemoveItem(new DnsRecord()); + assertThat(o.getDnsRecordsToRemove()).hasSize(1); + } + + @Test + void addLinksItemInitialiseListLinks() { + AgentRevocationResponse o = new AgentRevocationResponse(); + o.setLinks(null); + o.addLinksItem(new Link()); + assertThat(o.getLinks()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentStatusTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentStatusTest.java new file mode 100644 index 0000000..4a41112 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/AgentStatusTest.java @@ -0,0 +1,76 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class AgentStatusTest { + + private static AgentStatus populated() { + return new AgentStatus() + .status(AgentLifecycleStatus.PENDING_VALIDATION) + .phase(AgentStatus.PhaseEnum.INITIALIZATION) + .completedSteps(List.of("x")) + .pendingSteps(List.of("x")) + .createdAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .updatedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")); + } + + @Test + void gettersReflectFluentSetters() { + AgentStatus a = populated(); + AgentStatus b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + AgentStatus a = populated(); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new AgentStatus()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class AgentStatus"); + assertThat(new AgentStatus().toString()).contains("class AgentStatus"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + AgentStatus a = populated(); + String json = mapper.writeValueAsString(a); + AgentStatus back = mapper.readValue(json, AgentStatus.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addCompletedStepsItemInitialiseList() { + AgentStatus o = new AgentStatus(); + o.setCompletedSteps(null); + o.addCompletedStepsItem("x"); + assertThat(o.getCompletedSteps()).hasSize(1); + } + + @Test + void addPendingStepsItemInitialiseList() { + AgentStatus o = new AgentStatus(); + o.setPendingSteps(null); + o.addPendingStepsItem("x"); + assertThat(o.getPendingSteps()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> AgentStatus.PhaseEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogAttestationTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogAttestationTest.java new file mode 100644 index 0000000..b33143e --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogAttestationTest.java @@ -0,0 +1,49 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; + +import org.junit.jupiter.api.Test; + +class CatalogAttestationTest { + + private static CatalogAttestation populated() { + return new CatalogAttestation() + .type("x") + .uri(URI.create("https://example.com/x")) + .mediaType("x"); + } + + @Test + void gettersReflectFluentSetters() { + CatalogAttestation a = populated(); + CatalogAttestation b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogAttestation a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogAttestation()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogAttestation"); + assertThat(new CatalogAttestation().toString()).contains("class CatalogAttestation"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogAttestation a = populated(); + String json = mapper.writeValueAsString(a); + CatalogAttestation back = mapper.readValue(json, CatalogAttestation.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogDocumentTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogDocumentTest.java new file mode 100644 index 0000000..890a60c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogDocumentTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class CatalogDocumentTest { + + private static CatalogDocument populated() { + return new CatalogDocument() + .specVersion("x") + .host(new CatalogHostInfo()) + .entries(List.of(new CatalogEntry())); + } + + @Test + void gettersReflectFluentSetters() { + CatalogDocument a = populated(); + CatalogDocument b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogDocument a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogDocument()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogDocument"); + assertThat(new CatalogDocument().toString()).contains("class CatalogDocument"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogDocument a = populated(); + String json = mapper.writeValueAsString(a); + CatalogDocument back = mapper.readValue(json, CatalogDocument.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEntriesItemInitialiseList() { + CatalogDocument o = new CatalogDocument(); + o.setEntries(null); + o.addEntriesItem(new CatalogEntry()); + assertThat(o.getEntries()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryMetadataTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryMetadataTest.java new file mode 100644 index 0000000..2756e37 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryMetadataTest.java @@ -0,0 +1,49 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; + +import org.junit.jupiter.api.Test; + +class CatalogEntryMetadataTest { + + private static CatalogEntryMetadata populated() { + return new CatalogEntryMetadata() + .ansName("x") + .agentHost("x") + .badgeUrl(URI.create("https://example.com/x")); + } + + @Test + void gettersReflectFluentSetters() { + CatalogEntryMetadata a = populated(); + CatalogEntryMetadata b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogEntryMetadata a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogEntryMetadata()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogEntryMetadata"); + assertThat(new CatalogEntryMetadata().toString()).contains("class CatalogEntryMetadata"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogEntryMetadata a = populated(); + String json = mapper.writeValueAsString(a); + CatalogEntryMetadata back = mapper.readValue(json, CatalogEntryMetadata.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryTest.java new file mode 100644 index 0000000..5db993f --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogEntryTest.java @@ -0,0 +1,68 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class CatalogEntryTest { + + private static CatalogEntry populated() { + return new CatalogEntry() + .identifier("x") + .displayName("x") + .description("x") + .version("x") + .mediaType("x") + .url(URI.create("https://example.com/x")) + .data(new CatalogNested()) + .tags(List.of("x")) + .updatedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .publisher(new CatalogPublisher()) + .metadata(new CatalogEntryMetadata()) + .trustManifest(new CatalogTrustManifest()); + } + + @Test + void gettersReflectFluentSetters() { + CatalogEntry a = populated(); + CatalogEntry b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogEntry a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogEntry()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogEntry"); + assertThat(new CatalogEntry().toString()).contains("class CatalogEntry"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogEntry a = populated(); + String json = mapper.writeValueAsString(a); + CatalogEntry back = mapper.readValue(json, CatalogEntry.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addTagsItemInitialiseList() { + CatalogEntry o = new CatalogEntry(); + o.setTags(null); + o.addTagsItem("x"); + assertThat(o.getTags()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogHostInfoTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogHostInfoTest.java new file mode 100644 index 0000000..d38fec5 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogHostInfoTest.java @@ -0,0 +1,46 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class CatalogHostInfoTest { + + private static CatalogHostInfo populated() { + return new CatalogHostInfo() + .identifier("x") + .displayName("x"); + } + + @Test + void gettersReflectFluentSetters() { + CatalogHostInfo a = populated(); + CatalogHostInfo b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogHostInfo a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogHostInfo()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogHostInfo"); + assertThat(new CatalogHostInfo().toString()).contains("class CatalogHostInfo"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogHostInfo a = populated(); + String json = mapper.writeValueAsString(a); + CatalogHostInfo back = mapper.readValue(json, CatalogHostInfo.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogNestedTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogNestedTest.java new file mode 100644 index 0000000..eec3b51 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogNestedTest.java @@ -0,0 +1,55 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class CatalogNestedTest { + + private static CatalogNested populated() { + return new CatalogNested() + .specVersion("x") + .entries(List.of(new CatalogEntry())); + } + + @Test + void gettersReflectFluentSetters() { + CatalogNested a = populated(); + CatalogNested b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogNested a = populated(); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogNested()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogNested"); + assertThat(new CatalogNested().toString()).contains("class CatalogNested"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogNested a = populated(); + String json = mapper.writeValueAsString(a); + CatalogNested back = mapper.readValue(json, CatalogNested.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEntriesItemInitialiseList() { + CatalogNested o = new CatalogNested(); + o.setEntries(null); + o.addEntriesItem(new CatalogEntry()); + assertThat(o.getEntries()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogPublisherTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogPublisherTest.java new file mode 100644 index 0000000..cfcc462 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogPublisherTest.java @@ -0,0 +1,47 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class CatalogPublisherTest { + + private static CatalogPublisher populated() { + return new CatalogPublisher() + .identifier("x") + .displayName("x") + .identityType("x"); + } + + @Test + void gettersReflectFluentSetters() { + CatalogPublisher a = populated(); + CatalogPublisher b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogPublisher a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogPublisher()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogPublisher"); + assertThat(new CatalogPublisher().toString()).contains("class CatalogPublisher"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogPublisher a = populated(); + String json = mapper.writeValueAsString(a); + CatalogPublisher back = mapper.readValue(json, CatalogPublisher.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogTrustManifestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogTrustManifestTest.java new file mode 100644 index 0000000..1a40059 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CatalogTrustManifestTest.java @@ -0,0 +1,56 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class CatalogTrustManifestTest { + + private static CatalogTrustManifest populated() { + return new CatalogTrustManifest() + .identity("x") + .attestations(List.of(new CatalogAttestation())); + } + + @Test + void gettersReflectFluentSetters() { + CatalogTrustManifest a = populated(); + CatalogTrustManifest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CatalogTrustManifest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CatalogTrustManifest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CatalogTrustManifest"); + assertThat(new CatalogTrustManifest().toString()).contains("class CatalogTrustManifest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CatalogTrustManifest a = populated(); + String json = mapper.writeValueAsString(a); + CatalogTrustManifest back = mapper.readValue(json, CatalogTrustManifest.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addAttestationsItemInitialiseList() { + CatalogTrustManifest o = new CatalogTrustManifest(); + o.setAttestations(null); + o.addAttestationsItem(new CatalogAttestation()); + assertThat(o.getAttestations()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CertificateResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CertificateResponseTest.java new file mode 100644 index 0000000..3081a6f --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CertificateResponseTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class CertificateResponseTest { + + private static CertificateResponse populated() { + return new CertificateResponse() + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .certificateSubject("x") + .certificateIssuer("x") + .certificateSerialNumber("x") + .certificateValidFrom(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .certificateValidTo(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .certificatePEM("x") + .chainPEM("x") + .certificatePublicKeyAlgorithm("x") + .certificateSignatureAlgorithm("x"); + } + + @Test + void gettersReflectFluentSetters() { + CertificateResponse a = populated(); + CertificateResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CertificateResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CertificateResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CertificateResponse"); + assertThat(new CertificateResponse().toString()).contains("class CertificateResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CertificateResponse a = populated(); + String json = mapper.writeValueAsString(a); + CertificateResponse back = mapper.readValue(json, CertificateResponse.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecordTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecordTest.java new file mode 100644 index 0000000..9404db6 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoDnsRecordTest.java @@ -0,0 +1,47 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class ChallengeInfoDnsRecordTest { + + private static ChallengeInfoDnsRecord populated() { + return new ChallengeInfoDnsRecord() + .name("x") + .type("x") + .value("x"); + } + + @Test + void gettersReflectFluentSetters() { + ChallengeInfoDnsRecord a = populated(); + ChallengeInfoDnsRecord b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + ChallengeInfoDnsRecord a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new ChallengeInfoDnsRecord()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class ChallengeInfoDnsRecord"); + assertThat(new ChallengeInfoDnsRecord().toString()).contains("class ChallengeInfoDnsRecord"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + ChallengeInfoDnsRecord a = populated(); + String json = mapper.writeValueAsString(a); + ChallengeInfoDnsRecord back = mapper.readValue(json, ChallengeInfoDnsRecord.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoTest.java new file mode 100644 index 0000000..e6c71db --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ChallengeInfoTest.java @@ -0,0 +1,59 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; + +import org.junit.jupiter.api.Test; + +class ChallengeInfoTest { + + private static ChallengeInfo populated() { + return new ChallengeInfo() + .type(ChallengeInfo.TypeEnum.DNS_01) + .token("x") + .keyAuthorization("x") + .dnsRecord(new ChallengeInfoDnsRecord()) + .httpPath("x") + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")); + } + + @Test + void gettersReflectFluentSetters() { + ChallengeInfo a = populated(); + ChallengeInfo b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + ChallengeInfo a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new ChallengeInfo()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class ChallengeInfo"); + assertThat(new ChallengeInfo().toString()).contains("class ChallengeInfo"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + ChallengeInfo a = populated(); + String json = mapper.writeValueAsString(a); + ChallengeInfo back = mapper.readValue(json, ChallengeInfo.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> ChallengeInfo.TypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrStatusResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrStatusResponseTest.java new file mode 100644 index 0000000..7986731 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrStatusResponseTest.java @@ -0,0 +1,62 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class CsrStatusResponseTest { + + private static CsrStatusResponse populated() { + return new CsrStatusResponse() + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .type(CsrStatusResponse.TypeEnum.SERVER) + .status(CsrStatusResponse.StatusEnum.PENDING) + .submittedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .updatedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .failureReason("x"); + } + + @Test + void gettersReflectFluentSetters() { + CsrStatusResponse a = populated(); + CsrStatusResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CsrStatusResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CsrStatusResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CsrStatusResponse"); + assertThat(new CsrStatusResponse().toString()).contains("class CsrStatusResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CsrStatusResponse a = populated(); + String json = mapper.writeValueAsString(a); + CsrStatusResponse back = mapper.readValue(json, CsrStatusResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> CsrStatusResponse.TypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> CsrStatusResponse.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionRequestTest.java new file mode 100644 index 0000000..eafb1ef --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionRequestTest.java @@ -0,0 +1,45 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class CsrSubmissionRequestTest { + + private static CsrSubmissionRequest populated() { + return new CsrSubmissionRequest() + .csrPEM("x"); + } + + @Test + void gettersReflectFluentSetters() { + CsrSubmissionRequest a = populated(); + CsrSubmissionRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CsrSubmissionRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CsrSubmissionRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CsrSubmissionRequest"); + assertThat(new CsrSubmissionRequest().toString()).contains("class CsrSubmissionRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CsrSubmissionRequest a = populated(); + String json = mapper.writeValueAsString(a); + CsrSubmissionRequest back = mapper.readValue(json, CsrSubmissionRequest.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionResponseTest.java new file mode 100644 index 0000000..3e02bf5 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/CsrSubmissionResponseTest.java @@ -0,0 +1,48 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class CsrSubmissionResponseTest { + + private static CsrSubmissionResponse populated() { + return new CsrSubmissionResponse() + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .message("x"); + } + + @Test + void gettersReflectFluentSetters() { + CsrSubmissionResponse a = populated(); + CsrSubmissionResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + CsrSubmissionResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new CsrSubmissionResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class CsrSubmissionResponse"); + assertThat(new CsrSubmissionResponse().toString()).contains("class CsrSubmissionResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + CsrSubmissionResponse a = populated(); + String json = mapper.writeValueAsString(a); + CsrSubmissionResponse back = mapper.readValue(json, CsrSubmissionResponse.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DiscoveryProfileTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DiscoveryProfileTest.java new file mode 100644 index 0000000..1f282f1 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DiscoveryProfileTest.java @@ -0,0 +1,31 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class DiscoveryProfileTest { + + @Test + void valuesAndGetValue() { + assertThat(DiscoveryProfile.values()).containsExactly( + DiscoveryProfile.ANS_DNSAID, DiscoveryProfile.ANS_TXT); + assertThat(DiscoveryProfile.ANS_DNSAID.getValue()).isEqualTo("ANS_DNSAID"); + } + + @Test + void fromValueRoundTrip() { + for (DiscoveryProfile p : DiscoveryProfile.values()) { + assertThat(DiscoveryProfile.fromValue(p.getValue())).isEqualTo(p); + assertThat(p.toString()).isEqualTo(p.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> DiscoveryProfile.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsRecordTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsRecordTest.java new file mode 100644 index 0000000..b6c5183 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsRecordTest.java @@ -0,0 +1,60 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class DnsRecordTest { + + private static DnsRecord populated() { + return new DnsRecord() + .name("x") + .type(DnsRecord.TypeEnum.HTTPS) + .value("x") + .priority(1) + .ttl(1) + .purpose(DnsRecord.PurposeEnum.DISCOVERY) + .required(true); + } + + @Test + void gettersReflectFluentSetters() { + DnsRecord a = populated(); + DnsRecord b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + DnsRecord a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new DnsRecord()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class DnsRecord"); + assertThat(new DnsRecord().toString()).contains("class DnsRecord"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + DnsRecord a = populated(); + String json = mapper.writeValueAsString(a); + DnsRecord back = mapper.readValue(json, DnsRecord.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> DnsRecord.TypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> DnsRecord.PurposeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInnerTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInnerTest.java new file mode 100644 index 0000000..0d29bae --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorIncorrectRecordsInnerTest.java @@ -0,0 +1,49 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class DnsVerificationErrorIncorrectRecordsInnerTest { + + private static DnsVerificationErrorIncorrectRecordsInner populated() { + return new DnsVerificationErrorIncorrectRecordsInner() + .record(new DnsRecord()) + .found("x") + .expected("x"); + } + + @Test + void gettersReflectFluentSetters() { + DnsVerificationErrorIncorrectRecordsInner a = populated(); + DnsVerificationErrorIncorrectRecordsInner b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + DnsVerificationErrorIncorrectRecordsInner a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new DnsVerificationErrorIncorrectRecordsInner()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class DnsVerificationErrorIncorrectRecordsInner"); + assertThat(new DnsVerificationErrorIncorrectRecordsInner().toString()) + .contains("class DnsVerificationErrorIncorrectRecordsInner"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + DnsVerificationErrorIncorrectRecordsInner a = populated(); + String json = mapper.writeValueAsString(a); + DnsVerificationErrorIncorrectRecordsInner back = + mapper.readValue(json, DnsVerificationErrorIncorrectRecordsInner.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorTest.java new file mode 100644 index 0000000..a6c6f34 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/DnsVerificationErrorTest.java @@ -0,0 +1,72 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class DnsVerificationErrorTest { + + private static DnsVerificationError populated() { + return new DnsVerificationError() + .status(DnsVerificationError.StatusEnum.ERROR) + .missingRecords(List.of(new DnsRecord())) + .incorrectRecords(List.of(new DnsVerificationErrorIncorrectRecordsInner())); + } + + @Test + void gettersReflectFluentSetters() { + DnsVerificationError a = populated(); + DnsVerificationError b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + DnsVerificationError a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new DnsVerificationError()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class DnsVerificationError"); + assertThat(new DnsVerificationError().toString()).contains("class DnsVerificationError"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + DnsVerificationError a = populated(); + String json = mapper.writeValueAsString(a); + DnsVerificationError back = mapper.readValue(json, DnsVerificationError.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addMissingRecordsItemInitialiseList() { + DnsVerificationError o = new DnsVerificationError(); + o.setMissingRecords(null); + o.addMissingRecordsItem(new DnsRecord()); + assertThat(o.getMissingRecords()).hasSize(1); + } + + @Test + void addIncorrectRecordsItemInitialiseLis() { + DnsVerificationError o = new DnsVerificationError(); + o.setIncorrectRecords(null); + o.addIncorrectRecordsItem(new DnsVerificationErrorIncorrectRecordsInner()); + assertThat(o.getIncorrectRecords()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> DnsVerificationError.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ErrorResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ErrorResponseTest.java new file mode 100644 index 0000000..68468f2 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ErrorResponseTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +class ErrorResponseTest { + + private static ErrorResponse populated() { + return new ErrorResponse() + .status(ErrorResponse.StatusEnum.ERROR) + .code("x") + .message("x") + .details(Map.of("k", "v")); + } + + @Test + void gettersReflectFluentSetters() { + ErrorResponse a = populated(); + ErrorResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + ErrorResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new ErrorResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class ErrorResponse"); + assertThat(new ErrorResponse().toString()).contains("class ErrorResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + ErrorResponse a = populated(); + String json = mapper.writeValueAsString(a); + ErrorResponse back = mapper.readValue(json, ErrorResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> ErrorResponse.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventItemTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventItemTest.java new file mode 100644 index 0000000..b126b99 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventItemTest.java @@ -0,0 +1,75 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class EventItemTest { + + private static EventItem populated() { + return new EventItem() + .logId("x") + .eventType(EventItem.EventTypeEnum.AGENT_DEPRECATED) + .createdAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .ansName("x") + .agentHost("x") + .agentDisplayName("x") + .agentDescription("x") + .version("x") + .providerId("x") + .endpoints(List.of(new AgentEndpoint())); + } + + @Test + void gettersReflectFluentSetters() { + EventItem a = populated(); + EventItem b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + EventItem a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new EventItem()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class EventItem"); + assertThat(new EventItem().toString()).contains("class EventItem"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + EventItem a = populated(); + String json = mapper.writeValueAsString(a); + EventItem back = mapper.readValue(json, EventItem.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addEndpointsItemInitialiseList() { + EventItem o = new EventItem(); + o.setEndpoints(null); + o.addEndpointsItem(new AgentEndpoint()); + assertThat(o.getEndpoints()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> EventItem.EventTypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventPageResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventPageResponseTest.java new file mode 100644 index 0000000..b5cdd1b --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/EventPageResponseTest.java @@ -0,0 +1,56 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class EventPageResponseTest { + + private static EventPageResponse populated() { + return new EventPageResponse() + .items(List.of(new EventItem())) + .lastLogId("x"); + } + + @Test + void gettersReflectFluentSetters() { + EventPageResponse a = populated(); + EventPageResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + EventPageResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new EventPageResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class EventPageResponse"); + assertThat(new EventPageResponse().toString()).contains("class EventPageResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + EventPageResponse a = populated(); + String json = mapper.writeValueAsString(a); + EventPageResponse back = mapper.readValue(json, EventPageResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addItemsItemInitialiseList() { + EventPageResponse o = new EventPageResponse(); + o.setItems(null); + o.addItemsItem(new EventItem()); + assertThat(o.getItems()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityChallengeResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityChallengeResponseTest.java new file mode 100644 index 0000000..0784a65 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityChallengeResponseTest.java @@ -0,0 +1,72 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class IdentityChallengeResponseTest { + + private static IdentityChallengeResponse populated() { + return new IdentityChallengeResponse() + .identityId("x") + .kind(IdentityChallengeResponse.KindEnum.DID_WEB) + .value("x") + .status(IdentityLifecycleStatus.PENDING_CONTROL) + .nonce("x") + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .challenges(List.of(new IdentityProofChallenge())) + .presentationStatus(IdentityChallengeResponse.PresentationStatusEnum.AUTHORIZED); + } + + @Test + void gettersReflectFluentSetters() { + IdentityChallengeResponse a = populated(); + IdentityChallengeResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityChallengeResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityChallengeResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityChallengeResponse"); + assertThat(new IdentityChallengeResponse().toString()).contains("class IdentityChallengeResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityChallengeResponse a = populated(); + String json = mapper.writeValueAsString(a); + IdentityChallengeResponse back = mapper.readValue(json, IdentityChallengeResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addChallengesItemInitialiseList() { + IdentityChallengeResponse o = new IdentityChallengeResponse(); + o.setChallenges(null); + o.addChallengesItem(new IdentityProofChallenge()); + assertThat(o.getChallenges()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> IdentityChallengeResponse.KindEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> IdentityChallengeResponse.PresentationStatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInnerTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInnerTest.java new file mode 100644 index 0000000..f50f0cb --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsLinkedAgentsInnerTest.java @@ -0,0 +1,50 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class IdentityDetailsLinkedAgentsInnerTest { + + private static IdentityDetailsLinkedAgentsInner populated() { + return new IdentityDetailsLinkedAgentsInner() + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .linkedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")); + } + + @Test + void gettersReflectFluentSetters() { + IdentityDetailsLinkedAgentsInner a = populated(); + IdentityDetailsLinkedAgentsInner b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityDetailsLinkedAgentsInner a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityDetailsLinkedAgentsInner()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityDetailsLinkedAgentsInner"); + assertThat(new IdentityDetailsLinkedAgentsInner().toString()) + .contains("class IdentityDetailsLinkedAgentsInner"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityDetailsLinkedAgentsInner a = populated(); + String json = mapper.writeValueAsString(a); + IdentityDetailsLinkedAgentsInner back = mapper.readValue(json, IdentityDetailsLinkedAgentsInner.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsTest.java new file mode 100644 index 0000000..09caedf --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityDetailsTest.java @@ -0,0 +1,73 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class IdentityDetailsTest { + + private static IdentityDetails populated() { + return new IdentityDetails() + .identityId("x") + .kind(IdentityDetails.KindEnum.DID_WEB) + .value("x") + .status(IdentityLifecycleStatus.PENDING_CONTROL) + .proofMethod(IdentityDetails.ProofMethodEnum.DID_WEB_SIG) + .pendingValue("x") + .verifiedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .createdAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .linkedAgents(List.of(new IdentityDetailsLinkedAgentsInner())); + } + + @Test + void gettersReflectFluentSetters() { + IdentityDetails a = populated(); + IdentityDetails b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityDetails a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityDetails()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityDetails"); + assertThat(new IdentityDetails().toString()).contains("class IdentityDetails"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityDetails a = populated(); + String json = mapper.writeValueAsString(a); + IdentityDetails back = mapper.readValue(json, IdentityDetails.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addLinkedAgentsItemInitialiseList() { + IdentityDetails o = new IdentityDetails(); + o.setLinkedAgents(null); + o.addLinkedAgentsItem(new IdentityDetailsLinkedAgentsInner()); + assertThat(o.getLinkedAgents()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> IdentityDetails.KindEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> IdentityDetails.ProofMethodEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatusTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatusTest.java new file mode 100644 index 0000000..d713789 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLifecycleStatusTest.java @@ -0,0 +1,30 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class IdentityLifecycleStatusTest { + + @Test + void valuesAndGetValue() { + assertThat(IdentityLifecycleStatus.values()).hasSize(3); + assertThat(IdentityLifecycleStatus.VERIFIED.getValue()).isEqualTo("VERIFIED"); + } + + @Test + void fromValueRoundTrip() { + for (IdentityLifecycleStatus s : IdentityLifecycleStatus.values()) { + assertThat(IdentityLifecycleStatus.fromValue(s.getValue())).isEqualTo(s); + assertThat(s.toString()).isEqualTo(s.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> IdentityLifecycleStatus.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkRequestTest.java new file mode 100644 index 0000000..8815d5c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkRequestTest.java @@ -0,0 +1,56 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class IdentityLinkRequestTest { + + private static IdentityLinkRequest populated() { + return new IdentityLinkRequest() + .agentIds(List.of(UUID.fromString("11111111-1111-1111-1111-111111111111"))); + } + + @Test + void gettersReflectFluentSetters() { + IdentityLinkRequest a = populated(); + IdentityLinkRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityLinkRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityLinkRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityLinkRequest"); + assertThat(new IdentityLinkRequest().toString()).contains("class IdentityLinkRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityLinkRequest a = populated(); + String json = mapper.writeValueAsString(a); + IdentityLinkRequest back = mapper.readValue(json, IdentityLinkRequest.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addAgentIdsItemInitialiseList() { + IdentityLinkRequest o = new IdentityLinkRequest(); + o.setAgentIds(null); + o.addAgentIdsItem(UUID.fromString("11111111-1111-1111-1111-111111111111")); + assertThat(o.getAgentIds()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkResponseTest.java new file mode 100644 index 0000000..5b60118 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityLinkResponseTest.java @@ -0,0 +1,45 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class IdentityLinkResponseTest { + + private static IdentityLinkResponse populated() { + return new IdentityLinkResponse() + .linked(1); + } + + @Test + void gettersReflectFluentSetters() { + IdentityLinkResponse a = populated(); + IdentityLinkResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityLinkResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityLinkResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityLinkResponse"); + assertThat(new IdentityLinkResponse().toString()).contains("class IdentityLinkResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityLinkResponse a = populated(); + String json = mapper.writeValueAsString(a); + IdentityLinkResponse back = mapper.readValue(json, IdentityLinkResponse.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityListResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityListResponseTest.java new file mode 100644 index 0000000..a76719c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityListResponseTest.java @@ -0,0 +1,59 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class IdentityListResponseTest { + + private static IdentityListResponse populated() { + return new IdentityListResponse() + .items(List.of(new IdentityDetails())) + .returnedCount(1) + .limit(1) + .nextCursor("x") + .hasMore(true); + } + + @Test + void gettersReflectFluentSetters() { + IdentityListResponse a = populated(); + IdentityListResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityListResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityListResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityListResponse"); + assertThat(new IdentityListResponse().toString()).contains("class IdentityListResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityListResponse a = populated(); + String json = mapper.writeValueAsString(a); + IdentityListResponse back = mapper.readValue(json, IdentityListResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addItemsItemInitialiseList() { + IdentityListResponse o = new IdentityListResponse(); + o.setItems(null); + o.addItemsItem(new IdentityDetails()); + assertThat(o.getItems()).hasSize(1); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityProofChallengeTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityProofChallengeTest.java new file mode 100644 index 0000000..97abb13 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityProofChallengeTest.java @@ -0,0 +1,46 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class IdentityProofChallengeTest { + + private static IdentityProofChallenge populated() { + return new IdentityProofChallenge() + .kid("x") + .signingInput("x"); + } + + @Test + void gettersReflectFluentSetters() { + IdentityProofChallenge a = populated(); + IdentityProofChallenge b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityProofChallenge a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityProofChallenge()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityProofChallenge"); + assertThat(new IdentityProofChallenge().toString()).contains("class IdentityProofChallenge"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityProofChallenge a = populated(); + String json = mapper.writeValueAsString(a); + IdentityProofChallenge back = mapper.readValue(json, IdentityProofChallenge.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequestTest.java new file mode 100644 index 0000000..1f8d057 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/IdentityRegistrationRequestTest.java @@ -0,0 +1,46 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class IdentityRegistrationRequestTest { + + private static IdentityRegistrationRequest populated() { + return new IdentityRegistrationRequest() + .value("x") + .vleiPresentation(new VLEIPresentation()); + } + + @Test + void gettersReflectFluentSetters() { + IdentityRegistrationRequest a = populated(); + IdentityRegistrationRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + IdentityRegistrationRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new IdentityRegistrationRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class IdentityRegistrationRequest"); + assertThat(new IdentityRegistrationRequest().toString()).contains("class IdentityRegistrationRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + IdentityRegistrationRequest a = populated(); + String json = mapper.writeValueAsString(a); + IdentityRegistrationRequest back = mapper.readValue(json, IdentityRegistrationRequest.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkTest.java new file mode 100644 index 0000000..48643ca --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkTest.java @@ -0,0 +1,48 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; + +import org.junit.jupiter.api.Test; + +class LinkTest { + + private static Link populated() { + return new Link() + .rel("x") + .href(URI.create("https://example.com/x")); + } + + @Test + void gettersReflectFluentSetters() { + Link a = populated(); + Link b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + Link a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new Link()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class Link"); + assertThat(new Link().toString()).contains("class Link"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + Link a = populated(); + String json = mapper.writeValueAsString(a); + Link back = mapper.readValue(json, Link.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkedIdentityTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkedIdentityTest.java new file mode 100644 index 0000000..bfbc2e1 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/LinkedIdentityTest.java @@ -0,0 +1,60 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; + +import org.junit.jupiter.api.Test; + +class LinkedIdentityTest { + + private static LinkedIdentity populated() { + return new LinkedIdentity() + .identityId("x") + .kind(LinkedIdentity.KindEnum.DID_WEB) + .value("x") + .identityStatus(LinkedIdentity.IdentityStatusEnum.VERIFIED) + .linkedAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")); + } + + @Test + void gettersReflectFluentSetters() { + LinkedIdentity a = populated(); + LinkedIdentity b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + LinkedIdentity a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new LinkedIdentity()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class LinkedIdentity"); + assertThat(new LinkedIdentity().toString()).contains("class LinkedIdentity"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + LinkedIdentity a = populated(); + String json = mapper.writeValueAsString(a); + LinkedIdentity back = mapper.readValue(json, LinkedIdentity.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> LinkedIdentity.KindEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> LinkedIdentity.IdentityStatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ModelTestSupport.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ModelTestSupport.java new file mode 100644 index 0000000..9d55e8c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ModelTestSupport.java @@ -0,0 +1,22 @@ +package com.godaddy.ans.sdk.model; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +/** + * Shared JSON mapper for model round-trip tests. Registers the JSR-310 module so + * {@link java.time.OffsetDateTime} fields serialize and deserialize, and writes + * dates as ISO-8601 strings so a round-trip preserves value equality. + */ +final class ModelTestSupport { + + private ModelTestSupport() { + } + + static ObjectMapper mapper() { + return new ObjectMapper() + .registerModule(new JavaTimeModule()) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/NextStepTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/NextStepTest.java new file mode 100644 index 0000000..bfc818c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/NextStepTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; + +import org.junit.jupiter.api.Test; + +class NextStepTest { + + private static NextStep populated() { + return new NextStep() + .action(NextStep.ActionEnum.CONFIGURE_DNS) + .description("x") + .endpoint(URI.create("https://example.com/x")) + .estimatedTimeMinutes(1); + } + + @Test + void gettersReflectFluentSetters() { + NextStep a = populated(); + NextStep b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + NextStep a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new NextStep()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class NextStep"); + assertThat(new NextStep().toString()).contains("class NextStep"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + NextStep a = populated(); + String json = mapper.writeValueAsString(a); + NextStep back = mapper.readValue(json, NextStep.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> NextStep.ActionEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProblemTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProblemTest.java new file mode 100644 index 0000000..314167f --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProblemTest.java @@ -0,0 +1,49 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class ProblemTest { + + private static Problem populated() { + return new Problem() + .type("x") + .title("x") + .status(1) + .detail("x") + .code("x"); + } + + @Test + void gettersReflectFluentSetters() { + Problem a = populated(); + Problem b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + Problem a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new Problem()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class Problem"); + assertThat(new Problem().toString()).contains("class Problem"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + Problem a = populated(); + String json = mapper.writeValueAsString(a); + Problem back = mapper.readValue(json, Problem.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProtocolTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProtocolTest.java new file mode 100644 index 0000000..1699490 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ProtocolTest.java @@ -0,0 +1,33 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class ProtocolTest { + + @Test + void valuesAndGetValue() { + assertThat(Protocol.values()).containsExactly( + Protocol.A2_A, Protocol.MCP, Protocol.HTTP_API); + assertThat(Protocol.A2_A.getValue()).isEqualTo("A2A"); + assertThat(Protocol.MCP.getValue()).isEqualTo("MCP"); + assertThat(Protocol.HTTP_API.getValue()).isEqualTo("HTTP_API"); + } + + @Test + void fromValueRoundTrip() { + for (Protocol p : Protocol.values()) { + assertThat(Protocol.fromValue(p.getValue())).isEqualTo(p); + assertThat(p.toString()).isEqualTo(p.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> Protocol.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RegistrationPendingTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RegistrationPendingTest.java new file mode 100644 index 0000000..ac41281 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RegistrationPendingTest.java @@ -0,0 +1,95 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class RegistrationPendingTest { + + private static RegistrationPending populated() { + return new RegistrationPending() + .agentId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .status(RegistrationPending.StatusEnum.PENDING_VALIDATION) + .ansName("x") + .nextSteps(List.of(new NextStep())) + .challenges(List.of(new ChallengeInfo())) + .dnsRecords(List.of(new DnsRecord())) + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .links(List.of(new Link())); + } + + @Test + void gettersReflectFluentSetters() { + RegistrationPending a = populated(); + RegistrationPending b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + RegistrationPending a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new RegistrationPending()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class RegistrationPending"); + assertThat(new RegistrationPending().toString()).contains("class RegistrationPending"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + RegistrationPending a = populated(); + String json = mapper.writeValueAsString(a); + RegistrationPending back = mapper.readValue(json, RegistrationPending.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addNextStepsItemInitialiseList() { + RegistrationPending o = new RegistrationPending(); + o.setNextSteps(null); + o.addNextStepsItem(new NextStep()); + assertThat(o.getNextSteps()).hasSize(1); + } + + @Test + void addChallengeItemHelperInitialisesList() { + RegistrationPending o = new RegistrationPending(); + o.setChallenges(null); + o.addChallengesItem(new ChallengeInfo()); + assertThat(o.getChallenges()).hasSize(1); + } + + @Test + void addDnsRecordHelperInitialisesList() { + RegistrationPending o = new RegistrationPending(); + o.setDnsRecords(null); + o.addDnsRecordsItem(new DnsRecord()); + assertThat(o.getDnsRecords()).hasSize(1); + } + + @Test + void addLinkHelperInitialisesList() { + RegistrationPending o = new RegistrationPending(); + o.setLinks(null); + o.addLinksItem(new Link()); + assertThat(o.getLinks()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> RegistrationPending.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalStatusResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalStatusResponseTest.java new file mode 100644 index 0000000..966341d --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalStatusResponseTest.java @@ -0,0 +1,64 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class RenewalStatusResponseTest { + + private static RenewalStatusResponse populated() { + return new RenewalStatusResponse() + .renewalType(RenewalStatusResponse.RenewalTypeEnum.SERVER_CSR) + .status(RenewalStatusResponse.StatusEnum.PENDING_VALIDATION) + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .challenges(new RenewalSubmissionResponseChallenges()) + .tlsaDnsRecord(new DnsRecord()) + .failureReason("x") + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .nextStep(new NextStep()); + } + + @Test + void gettersReflectFluentSetters() { + RenewalStatusResponse a = populated(); + RenewalStatusResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + RenewalStatusResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new RenewalStatusResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class RenewalStatusResponse"); + assertThat(new RenewalStatusResponse().toString()).contains("class RenewalStatusResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + RenewalStatusResponse a = populated(); + String json = mapper.writeValueAsString(a); + RenewalStatusResponse back = mapper.readValue(json, RenewalStatusResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> RenewalStatusResponse.RenewalTypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> RenewalStatusResponse.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallengesTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallengesTest.java new file mode 100644 index 0000000..1e960b3 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseChallengesTest.java @@ -0,0 +1,47 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class RenewalSubmissionResponseChallengesTest { + + private static RenewalSubmissionResponseChallenges populated() { + return new RenewalSubmissionResponseChallenges() + .dns01(new ChallengeInfo()) + .http01(new ChallengeInfo()); + } + + @Test + void gettersReflectFluentSetters() { + RenewalSubmissionResponseChallenges a = populated(); + RenewalSubmissionResponseChallenges b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + RenewalSubmissionResponseChallenges a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new RenewalSubmissionResponseChallenges()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class RenewalSubmissionResponseChallenges"); + assertThat(new RenewalSubmissionResponseChallenges().toString()) + .contains("class RenewalSubmissionResponseChallenges"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + RenewalSubmissionResponseChallenges a = populated(); + String json = mapper.writeValueAsString(a); + RenewalSubmissionResponseChallenges back = mapper.readValue(json, RenewalSubmissionResponseChallenges.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseTest.java new file mode 100644 index 0000000..cdce2af --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalSubmissionResponseTest.java @@ -0,0 +1,72 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class RenewalSubmissionResponseTest { + + private static RenewalSubmissionResponse populated() { + return new RenewalSubmissionResponse() + .renewalType(RenewalSubmissionResponse.RenewalTypeEnum.SERVER_CSR) + .status(RenewalSubmissionResponse.StatusEnum.PENDING_VALIDATION) + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .challenges(new RenewalSubmissionResponseChallenges()) + .expiresAt(OffsetDateTime.parse("2026-01-01T00:00:00Z")) + .nextStep(new NextStep()) + .links(List.of(new Link())); + } + + @Test + void gettersReflectFluentSetters() { + RenewalSubmissionResponse a = populated(); + RenewalSubmissionResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + RenewalSubmissionResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new RenewalSubmissionResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class RenewalSubmissionResponse"); + assertThat(new RenewalSubmissionResponse().toString()).contains("class RenewalSubmissionResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + RenewalSubmissionResponse a = populated(); + String json = mapper.writeValueAsString(a); + RenewalSubmissionResponse back = mapper.readValue(json, RenewalSubmissionResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addLinksItemInitialiseList() { + RenewalSubmissionResponse o = new RenewalSubmissionResponse(); + o.setLinks(null); + o.addLinksItem(new Link()); + assertThat(o.getLinks()).hasSize(1); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> RenewalSubmissionResponse.RenewalTypeEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + assertThat(catchThrowable(() -> RenewalSubmissionResponse.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalVerificationResponseTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalVerificationResponseTest.java new file mode 100644 index 0000000..a74fee3 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RenewalVerificationResponseTest.java @@ -0,0 +1,57 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.UUID; + +import org.junit.jupiter.api.Test; + +class RenewalVerificationResponseTest { + + private static RenewalVerificationResponse populated() { + return new RenewalVerificationResponse() + .status(RenewalVerificationResponse.StatusEnum.VERIFIED) + .csrId(UUID.fromString("11111111-1111-1111-1111-111111111111")) + .tlsaDnsRecord(new DnsRecord()) + .nextStep(new NextStep()); + } + + @Test + void gettersReflectFluentSetters() { + RenewalVerificationResponse a = populated(); + RenewalVerificationResponse b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + RenewalVerificationResponse a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new RenewalVerificationResponse()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class RenewalVerificationResponse"); + assertThat(new RenewalVerificationResponse().toString()).contains("class RenewalVerificationResponse"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + RenewalVerificationResponse a = populated(); + String json = mapper.writeValueAsString(a); + RenewalVerificationResponse back = mapper.readValue(json, RenewalVerificationResponse.class); + assertThat(back).isEqualTo(a); + } + + @Test + void nestedEnumsRejectUnknown() { + assertThat(catchThrowable(() -> RenewalVerificationResponse.StatusEnum.fromValue("NOPE"))) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RevocationReasonTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RevocationReasonTest.java new file mode 100644 index 0000000..2f0b5eb --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/RevocationReasonTest.java @@ -0,0 +1,30 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class RevocationReasonTest { + + @Test + void valuesAndGetValue() { + assertThat(RevocationReason.values()).hasSize(7); + assertThat(RevocationReason.KEY_COMPROMISE.getValue()).isEqualTo("KEY_COMPROMISE"); + } + + @Test + void fromValueRoundTrip() { + for (RevocationReason r : RevocationReason.values()) { + assertThat(RevocationReason.fromValue(r.getValue())).isEqualTo(r); + assertThat(r.toString()).isEqualTo(r.getValue()); + } + } + + @Test + void fromValueRejectsUnknown() { + assertThatThrownBy(() -> RevocationReason.fromValue("NOPE")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("NOPE"); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequestTest.java new file mode 100644 index 0000000..c9c080c --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/ServerCertificateRenewalRequestTest.java @@ -0,0 +1,47 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class ServerCertificateRenewalRequestTest { + + private static ServerCertificateRenewalRequest populated() { + return new ServerCertificateRenewalRequest() + .serverCsrPEM("x") + .serverCertificatePEM("x") + .serverCertificateChainPEM("x"); + } + + @Test + void gettersReflectFluentSetters() { + ServerCertificateRenewalRequest a = populated(); + ServerCertificateRenewalRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + ServerCertificateRenewalRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new ServerCertificateRenewalRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class ServerCertificateRenewalRequest"); + assertThat(new ServerCertificateRenewalRequest().toString()).contains("class ServerCertificateRenewalRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + ServerCertificateRenewalRequest a = populated(); + String json = mapper.writeValueAsString(a); + ServerCertificateRenewalRequest back = mapper.readValue(json, ServerCertificateRenewalRequest.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VLEIPresentationTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VLEIPresentationTest.java new file mode 100644 index 0000000..43e8f76 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VLEIPresentationTest.java @@ -0,0 +1,45 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +class VLEIPresentationTest { + + private static VLEIPresentation populated() { + return new VLEIPresentation() + .cesr("x"); + } + + @Test + void gettersReflectFluentSetters() { + VLEIPresentation a = populated(); + VLEIPresentation b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + VLEIPresentation a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new VLEIPresentation()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class VLEIPresentation"); + assertThat(new VLEIPresentation().toString()).contains("class VLEIPresentation"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + VLEIPresentation a = populated(); + String json = mapper.writeValueAsString(a); + VLEIPresentation back = mapper.readValue(json, VLEIPresentation.class); + assertThat(back).isEqualTo(a); + } +} diff --git a/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VerifyControlRequestTest.java b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VerifyControlRequestTest.java new file mode 100644 index 0000000..e5f71e7 --- /dev/null +++ b/ans-sdk-api/src/test/java/com/godaddy/ans/sdk/model/VerifyControlRequestTest.java @@ -0,0 +1,56 @@ +package com.godaddy.ans.sdk.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class VerifyControlRequestTest { + + private static VerifyControlRequest populated() { + return new VerifyControlRequest() + .signedProofs(List.of("x")) + .cesrSignature("x"); + } + + @Test + void gettersReflectFluentSetters() { + VerifyControlRequest a = populated(); + VerifyControlRequest b = populated(); + assertThat(a).isEqualTo(b).hasSameHashCodeAs(b); + } + + @Test + void equalsAndHashCodeContract() { + VerifyControlRequest a = populated(); + assertThat(a).isEqualTo(a); + assertThat(a).isNotEqualTo(null); + assertThat(a).isNotEqualTo("other-type"); + assertThat(a).isNotEqualTo(new VerifyControlRequest()); + } + + @Test + void toStringContainsClassName() { + assertThat(populated().toString()).contains("class VerifyControlRequest"); + assertThat(new VerifyControlRequest().toString()).contains("class VerifyControlRequest"); + } + + @Test + void jacksonRoundTrip() throws Exception { + ObjectMapper mapper = ModelTestSupport.mapper(); + VerifyControlRequest a = populated(); + String json = mapper.writeValueAsString(a); + VerifyControlRequest back = mapper.readValue(json, VerifyControlRequest.class); + assertThat(back).isEqualTo(a); + } + + @Test + void addSignedProofsItemInitialiseList() { + VerifyControlRequest o = new VerifyControlRequest(); + o.setSignedProofs(null); + o.addSignedProofsItem("x"); + assertThat(o.getSignedProofs()).hasSize(1); + } +} diff --git a/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/DiscoveryClient.java b/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/DiscoveryClient.java index 12ebcfd..65e1cc4 100644 --- a/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/DiscoveryClient.java +++ b/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/DiscoveryClient.java @@ -4,7 +4,7 @@ import com.godaddy.ans.sdk.concurrent.AnsExecutors; import com.godaddy.ans.sdk.config.AnsConfiguration; import com.godaddy.ans.sdk.config.Environment; -import com.godaddy.ans.sdk.model.generated.AgentDetails; +import com.godaddy.ans.sdk.model.AgentDetails; import java.time.Duration; import java.util.concurrent.CompletableFuture; diff --git a/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/ResolutionService.java b/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/ResolutionService.java index 8682a5d..b077bbb 100644 --- a/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/ResolutionService.java +++ b/ans-sdk-discovery/src/main/java/com/godaddy/ans/sdk/discovery/ResolutionService.java @@ -10,7 +10,7 @@ import com.godaddy.ans.sdk.exception.AnsServerException; import com.godaddy.ans.sdk.exception.AnsValidationException; import com.godaddy.ans.sdk.http.HttpClientFactory; -import com.godaddy.ans.sdk.model.generated.AgentDetails; +import com.godaddy.ans.sdk.model.AgentDetails; import java.io.IOException; import java.net.URI; diff --git a/ans-sdk-discovery/src/test/java/com/godaddy/ans/sdk/discovery/DiscoveryClientTest.java b/ans-sdk-discovery/src/test/java/com/godaddy/ans/sdk/discovery/DiscoveryClientTest.java index 9cffaa5..61cb2d2 100644 --- a/ans-sdk-discovery/src/test/java/com/godaddy/ans/sdk/discovery/DiscoveryClientTest.java +++ b/ans-sdk-discovery/src/test/java/com/godaddy/ans/sdk/discovery/DiscoveryClientTest.java @@ -5,8 +5,8 @@ import com.godaddy.ans.sdk.auth.JwtCredentialsProvider; import com.godaddy.ans.sdk.config.AnsConfiguration; import com.godaddy.ans.sdk.config.Environment; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentLifecycleStatus; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentLifecycleStatus; import com.godaddy.ans.sdk.exception.AnsAuthenticationException; import com.godaddy.ans.sdk.exception.AnsNotFoundException; import com.godaddy.ans.sdk.exception.AnsServerException; diff --git a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/CertificateService.java b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/CertificateService.java index ca317c3..fe5f1f7 100644 --- a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/CertificateService.java +++ b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/CertificateService.java @@ -5,7 +5,7 @@ import com.godaddy.ans.sdk.exception.AnsAuthenticationException; import com.godaddy.ans.sdk.exception.AnsNotFoundException; import com.godaddy.ans.sdk.exception.AnsServerException; -import com.godaddy.ans.sdk.model.generated.CertificateResponse; +import com.godaddy.ans.sdk.model.CertificateResponse; import java.net.http.HttpRequest; import java.net.http.HttpResponse; diff --git a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationClient.java b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationClient.java index 23da29b..35bbbdc 100644 --- a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationClient.java +++ b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationClient.java @@ -5,12 +5,12 @@ import com.godaddy.ans.sdk.config.AnsConfiguration; import com.godaddy.ans.sdk.config.ApiVersion; import com.godaddy.ans.sdk.config.Environment; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentRegistrationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationResponse; -import com.godaddy.ans.sdk.model.generated.AgentStatus; -import com.godaddy.ans.sdk.model.generated.RevocationReason; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentRegistrationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationResponse; +import com.godaddy.ans.sdk.model.AgentStatus; +import com.godaddy.ans.sdk.model.RevocationReason; import java.time.Duration; import java.util.concurrent.CompletableFuture; diff --git a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationService.java b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationService.java index 538bd03..d413c4c 100644 --- a/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationService.java +++ b/ans-sdk-registration/src/main/java/com/godaddy/ans/sdk/registration/RegistrationService.java @@ -2,13 +2,13 @@ import com.godaddy.ans.sdk.config.ApiVersion; import com.godaddy.ans.sdk.exception.AnsServerException; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentRegistrationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationResponse; -import com.godaddy.ans.sdk.model.generated.AgentStatus; -import com.godaddy.ans.sdk.model.generated.Link; -import com.godaddy.ans.sdk.model.generated.RegistrationPending; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentRegistrationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationResponse; +import com.godaddy.ans.sdk.model.AgentStatus; +import com.godaddy.ans.sdk.model.Link; +import com.godaddy.ans.sdk.model.RegistrationPending; import java.net.http.HttpRequest; import java.net.http.HttpResponse; diff --git a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/ApiVersionRoutingTest.java b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/ApiVersionRoutingTest.java index d56281c..2449139 100644 --- a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/ApiVersionRoutingTest.java +++ b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/ApiVersionRoutingTest.java @@ -10,11 +10,11 @@ import com.godaddy.ans.sdk.exception.AnsNotFoundException; import com.godaddy.ans.sdk.exception.AnsServerException; import com.godaddy.ans.sdk.exception.AnsValidationException; -import com.godaddy.ans.sdk.model.generated.AgentEndpoint; -import com.godaddy.ans.sdk.model.generated.AgentRegistrationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationRequest; -import com.godaddy.ans.sdk.model.generated.Protocol; -import com.godaddy.ans.sdk.model.generated.RevocationReason; +import com.godaddy.ans.sdk.model.AgentEndpoint; +import com.godaddy.ans.sdk.model.AgentRegistrationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationRequest; +import com.godaddy.ans.sdk.model.Protocol; +import com.godaddy.ans.sdk.model.RevocationReason; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/CertificateServiceTest.java b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/CertificateServiceTest.java index 175e686..3c731df 100644 --- a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/CertificateServiceTest.java +++ b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/CertificateServiceTest.java @@ -10,7 +10,7 @@ import com.godaddy.ans.sdk.exception.AnsNotFoundException; import com.godaddy.ans.sdk.exception.AnsServerException; import com.godaddy.ans.sdk.exception.AnsValidationException; -import com.godaddy.ans.sdk.model.generated.CertificateResponse; +import com.godaddy.ans.sdk.model.CertificateResponse; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/RegistrationClientTest.java b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/RegistrationClientTest.java index a68f396..63a7f24 100644 --- a/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/RegistrationClientTest.java +++ b/ans-sdk-registration/src/test/java/com/godaddy/ans/sdk/registration/RegistrationClientTest.java @@ -10,16 +10,16 @@ import com.godaddy.ans.sdk.exception.AnsNotFoundException; import com.godaddy.ans.sdk.exception.AnsServerException; import com.godaddy.ans.sdk.exception.AnsValidationException; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentEndpoint; -import com.godaddy.ans.sdk.model.generated.AgentLifecycleStatus; -import com.godaddy.ans.sdk.model.generated.AgentRegistrationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationRequest; -import com.godaddy.ans.sdk.model.generated.AgentRevocationResponse; -import com.godaddy.ans.sdk.model.generated.AgentStatus; -import com.godaddy.ans.sdk.model.generated.Protocol; -import com.godaddy.ans.sdk.model.generated.RegistrationPending; -import com.godaddy.ans.sdk.model.generated.RevocationReason; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentEndpoint; +import com.godaddy.ans.sdk.model.AgentLifecycleStatus; +import com.godaddy.ans.sdk.model.AgentRegistrationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationRequest; +import com.godaddy.ans.sdk.model.AgentRevocationResponse; +import com.godaddy.ans.sdk.model.AgentStatus; +import com.godaddy.ans.sdk.model.Protocol; +import com.godaddy.ans.sdk.model.RegistrationPending; +import com.godaddy.ans.sdk.model.RevocationReason; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; diff --git a/ans-sdk-spring-boot-starter/examples/spring-boot-app/src/main/java/com/godaddy/ans/examples/springboot/AgentController.java b/ans-sdk-spring-boot-starter/examples/spring-boot-app/src/main/java/com/godaddy/ans/examples/springboot/AgentController.java index 9962e63..21eed54 100644 --- a/ans-sdk-spring-boot-starter/examples/spring-boot-app/src/main/java/com/godaddy/ans/examples/springboot/AgentController.java +++ b/ans-sdk-spring-boot-starter/examples/spring-boot-app/src/main/java/com/godaddy/ans/examples/springboot/AgentController.java @@ -2,8 +2,8 @@ import com.godaddy.ans.sdk.config.Environment; import com.godaddy.ans.sdk.discovery.DiscoveryClient; -import com.godaddy.ans.sdk.model.generated.AgentDetails; -import com.godaddy.ans.sdk.model.generated.AgentRegistrationRequest; +import com.godaddy.ans.sdk.model.AgentDetails; +import com.godaddy.ans.sdk.model.AgentRegistrationRequest; import com.godaddy.ans.sdk.registration.RegistrationClient; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; From f9fbe5e0f07620c37177801f76802330e2f8f344 Mon Sep 17 00:00:00 2001 From: James Hateley Date: Thu, 30 Jul 2026 12:42:04 +1000 Subject: [PATCH 2/2] fix: formatting fix Signed-off-by: James Hateley --- .../src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java | 3 ++- .../src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java | 3 ++- .../java/com/godaddy/ans/sdk/model/IdentityListResponse.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java index 0603fab..ca4bdf7 100644 --- a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentDetails.java @@ -29,7 +29,8 @@ AgentDetails.JSON_PROPERTY_REGISTRATION_PENDING, AgentDetails.JSON_PROPERTY_LINKS, AgentDetails.JSON_PROPERTY_IDENTITIES -})public class AgentDetails { +}) +public class AgentDetails { public static final String JSON_PROPERTY_AGENT_ID = "agentId"; @Nonnull diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java index df66761..36250d6 100644 --- a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/AgentEndpoint.java @@ -24,7 +24,8 @@ AgentEndpoint.JSON_PROPERTY_PROTOCOL, AgentEndpoint.JSON_PROPERTY_FUNCTIONS, AgentEndpoint.JSON_PROPERTY_TRANSPORTS -})public class AgentEndpoint { +}) +public class AgentEndpoint { public static final String JSON_PROPERTY_AGENT_URL = "agentUrl"; diff --git a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java index a64f9b6..c6443cf 100644 --- a/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java +++ b/ans-sdk-api/src/main/java/com/godaddy/ans/sdk/model/IdentityListResponse.java @@ -21,7 +21,8 @@ IdentityListResponse.JSON_PROPERTY_LIMIT, IdentityListResponse.JSON_PROPERTY_NEXT_CURSOR, IdentityListResponse.JSON_PROPERTY_HAS_MORE -})public class IdentityListResponse { +}) +public class IdentityListResponse { public static final String JSON_PROPERTY_ITEMS = "items"; @Nonnull