Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(don't merge) test smithy-dafny PR 496 #1323

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CreateAwsKmsHierarchicalKeyringInput {
/**
* How many seconds the Branch Key material is allowed to be reused within the local cache before it is re-retrieved from Amazon DynamoDB and re-authenticated with AWS KMS.
*/
private final long ttlSeconds;
private final Long ttlSeconds;

/**
* Sets the type of cache for this Hierarchical Keyring. By providing an already initialized 'Shared' cache, users can determine the scope of the cache. That is, if the cache is shared across other Cryptographic Material Providers, for instance other Hierarchical Keyrings or Caching Cryptographic Materials Managers (Caching CMMs). If any other type of cache in the CacheType union is provided, the Hierarchical Keyring will initialize a cache of that type, to be used with only this Hierarchical Keyring. If not set, a DefaultCache is initialized to be used with only this Hierarchical Keyring with entryCapacity = 1000.
Expand Down Expand Up @@ -76,7 +76,7 @@ public KeyStore keyStore() {
/**
* @return How many seconds the Branch Key material is allowed to be reused within the local cache before it is re-retrieved from Amazon DynamoDB and re-authenticated with AWS KMS.
*/
public long ttlSeconds() {
public Long ttlSeconds() {
return this.ttlSeconds;
}

Expand Down Expand Up @@ -136,12 +136,12 @@ public interface Builder {
/**
* @param ttlSeconds How many seconds the Branch Key material is allowed to be reused within the local cache before it is re-retrieved from Amazon DynamoDB and re-authenticated with AWS KMS.
*/
Builder ttlSeconds(long ttlSeconds);
Builder ttlSeconds(Long ttlSeconds);

/**
* @return How many seconds the Branch Key material is allowed to be reused within the local cache before it is re-retrieved from Amazon DynamoDB and re-authenticated with AWS KMS.
*/
long ttlSeconds();
Long ttlSeconds();

/**
* @param cache Sets the type of cache for this Hierarchical Keyring. By providing an already initialized 'Shared' cache, users can determine the scope of the cache. That is, if the cache is shared across other Cryptographic Material Providers, for instance other Hierarchical Keyrings or Caching Cryptographic Materials Managers (Caching CMMs). If any other type of cache in the CacheType union is provided, the Hierarchical Keyring will initialize a cache of that type, to be used with only this Hierarchical Keyring. If not set, a DefaultCache is initialized to be used with only this Hierarchical Keyring with entryCapacity = 1000.
Expand Down Expand Up @@ -174,9 +174,7 @@ static class BuilderImpl implements Builder {

protected KeyStore keyStore;

protected long ttlSeconds;

private boolean _ttlSecondsSet = false;
protected Long ttlSeconds;

protected CacheType cache;

Expand All @@ -189,7 +187,6 @@ protected BuilderImpl(CreateAwsKmsHierarchicalKeyringInput model) {
this.branchKeyIdSupplier = model.branchKeyIdSupplier();
this.keyStore = model.keyStore();
this.ttlSeconds = model.ttlSeconds();
this._ttlSecondsSet = true;
this.cache = model.cache();
this.partitionId = model.partitionId();
}
Expand Down Expand Up @@ -223,13 +220,12 @@ public KeyStore keyStore() {
return this.keyStore;
}

public Builder ttlSeconds(long ttlSeconds) {
public Builder ttlSeconds(Long ttlSeconds) {
this.ttlSeconds = ttlSeconds;
this._ttlSecondsSet = true;
return this;
}

public long ttlSeconds() {
public Long ttlSeconds() {
return this.ttlSeconds;
}

Expand Down Expand Up @@ -257,12 +253,12 @@ public CreateAwsKmsHierarchicalKeyringInput build() {
"Missing value for required field `keyStore`"
);
}
if (!this._ttlSecondsSet) {
if (Objects.isNull(this.ttlSeconds())) {
throw new IllegalArgumentException(
"Missing value for required field `ttlSeconds`"
);
}
if (this._ttlSecondsSet && this.ttlSeconds() < 0) {
if (Objects.nonNull(this.ttlSeconds()) && this.ttlSeconds() < 0) {
throw new IllegalArgumentException(
"`ttlSeconds` must be greater than or equal to 0"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
package software.amazon.cryptography.materialproviders.model;

import java.util.Objects;

/**
* The best choice for most situations. Probably a StormTrackingCache.
*/
Expand All @@ -11,7 +13,7 @@ public class DefaultCache {
/**
* Maximum number of entries cached.
*/
private final int entryCapacity;
private final Integer entryCapacity;

protected DefaultCache(BuilderImpl builder) {
this.entryCapacity = builder.entryCapacity();
Expand All @@ -20,7 +22,7 @@ protected DefaultCache(BuilderImpl builder) {
/**
* @return Maximum number of entries cached.
*/
public int entryCapacity() {
public Integer entryCapacity() {
return this.entryCapacity;
}

Expand All @@ -36,46 +38,42 @@ public interface Builder {
/**
* @param entryCapacity Maximum number of entries cached.
*/
Builder entryCapacity(int entryCapacity);
Builder entryCapacity(Integer entryCapacity);

/**
* @return Maximum number of entries cached.
*/
int entryCapacity();
Integer entryCapacity();

DefaultCache build();
}

static class BuilderImpl implements Builder {

protected int entryCapacity;

private boolean _entryCapacitySet = false;
protected Integer entryCapacity;

protected BuilderImpl() {}

protected BuilderImpl(DefaultCache model) {
this.entryCapacity = model.entryCapacity();
this._entryCapacitySet = true;
}

public Builder entryCapacity(int entryCapacity) {
public Builder entryCapacity(Integer entryCapacity) {
this.entryCapacity = entryCapacity;
this._entryCapacitySet = true;
return this;
}

public int entryCapacity() {
public Integer entryCapacity() {
return this.entryCapacity;
}

public DefaultCache build() {
if (!this._entryCapacitySet) {
if (Objects.isNull(this.entryCapacity())) {
throw new IllegalArgumentException(
"Missing value for required field `entryCapacity`"
);
}
if (this._entryCapacitySet && this.entryCapacity() < 1) {
if (Objects.nonNull(this.entryCapacity()) && this.entryCapacity() < 1) {
throw new IllegalArgumentException(
"`entryCapacity` must be greater than or equal to 1"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public class GetCacheEntryOutput {

private final Materials materials;

private final long creationTime;
private final Long creationTime;

private final long expiryTime;
private final Long expiryTime;

private final int messagesUsed;
private final Integer messagesUsed;

private final int bytesUsed;
private final Integer bytesUsed;

protected GetCacheEntryOutput(BuilderImpl builder) {
this.materials = builder.materials();
Expand All @@ -29,19 +29,19 @@ public Materials materials() {
return this.materials;
}

public long creationTime() {
public Long creationTime() {
return this.creationTime;
}

public long expiryTime() {
public Long expiryTime() {
return this.expiryTime;
}

public int messagesUsed() {
public Integer messagesUsed() {
return this.messagesUsed;
}

public int bytesUsed() {
public Integer bytesUsed() {
return this.bytesUsed;
}

Expand All @@ -58,21 +58,21 @@ public interface Builder {

Materials materials();

Builder creationTime(long creationTime);
Builder creationTime(Long creationTime);

long creationTime();
Long creationTime();

Builder expiryTime(long expiryTime);
Builder expiryTime(Long expiryTime);

long expiryTime();
Long expiryTime();

Builder messagesUsed(int messagesUsed);
Builder messagesUsed(Integer messagesUsed);

int messagesUsed();
Integer messagesUsed();

Builder bytesUsed(int bytesUsed);
Builder bytesUsed(Integer bytesUsed);

int bytesUsed();
Integer bytesUsed();

GetCacheEntryOutput build();
}
Expand All @@ -81,34 +81,22 @@ static class BuilderImpl implements Builder {

protected Materials materials;

protected long creationTime;
protected Long creationTime;

private boolean _creationTimeSet = false;
protected Long expiryTime;

protected long expiryTime;
protected Integer messagesUsed;

private boolean _expiryTimeSet = false;

protected int messagesUsed;

private boolean _messagesUsedSet = false;

protected int bytesUsed;

private boolean _bytesUsedSet = false;
protected Integer bytesUsed;

protected BuilderImpl() {}

protected BuilderImpl(GetCacheEntryOutput model) {
this.materials = model.materials();
this.creationTime = model.creationTime();
this._creationTimeSet = true;
this.expiryTime = model.expiryTime();
this._expiryTimeSet = true;
this.messagesUsed = model.messagesUsed();
this._messagesUsedSet = true;
this.bytesUsed = model.bytesUsed();
this._bytesUsedSet = true;
}

public Builder materials(Materials materials) {
Expand All @@ -120,43 +108,39 @@ public Materials materials() {
return this.materials;
}

public Builder creationTime(long creationTime) {
public Builder creationTime(Long creationTime) {
this.creationTime = creationTime;
this._creationTimeSet = true;
return this;
}

public long creationTime() {
public Long creationTime() {
return this.creationTime;
}

public Builder expiryTime(long expiryTime) {
public Builder expiryTime(Long expiryTime) {
this.expiryTime = expiryTime;
this._expiryTimeSet = true;
return this;
}

public long expiryTime() {
public Long expiryTime() {
return this.expiryTime;
}

public Builder messagesUsed(int messagesUsed) {
public Builder messagesUsed(Integer messagesUsed) {
this.messagesUsed = messagesUsed;
this._messagesUsedSet = true;
return this;
}

public int messagesUsed() {
public Integer messagesUsed() {
return this.messagesUsed;
}

public Builder bytesUsed(int bytesUsed) {
public Builder bytesUsed(Integer bytesUsed) {
this.bytesUsed = bytesUsed;
this._bytesUsedSet = true;
return this;
}

public int bytesUsed() {
public Integer bytesUsed() {
return this.bytesUsed;
}

Expand All @@ -166,42 +150,42 @@ public GetCacheEntryOutput build() {
"Missing value for required field `materials`"
);
}
if (!this._creationTimeSet) {
if (Objects.isNull(this.creationTime())) {
throw new IllegalArgumentException(
"Missing value for required field `creationTime`"
);
}
if (this._creationTimeSet && this.creationTime() < 0) {
if (Objects.nonNull(this.creationTime()) && this.creationTime() < 0) {
throw new IllegalArgumentException(
"`creationTime` must be greater than or equal to 0"
);
}
if (!this._expiryTimeSet) {
if (Objects.isNull(this.expiryTime())) {
throw new IllegalArgumentException(
"Missing value for required field `expiryTime`"
);
}
if (this._expiryTimeSet && this.expiryTime() < 0) {
if (Objects.nonNull(this.expiryTime()) && this.expiryTime() < 0) {
throw new IllegalArgumentException(
"`expiryTime` must be greater than or equal to 0"
);
}
if (!this._messagesUsedSet) {
if (Objects.isNull(this.messagesUsed())) {
throw new IllegalArgumentException(
"Missing value for required field `messagesUsed`"
);
}
if (this._messagesUsedSet && this.messagesUsed() < 0) {
if (Objects.nonNull(this.messagesUsed()) && this.messagesUsed() < 0) {
throw new IllegalArgumentException(
"`messagesUsed` must be greater than or equal to 0"
);
}
if (!this._bytesUsedSet) {
if (Objects.isNull(this.bytesUsed())) {
throw new IllegalArgumentException(
"Missing value for required field `bytesUsed`"
);
}
if (this._bytesUsedSet && this.bytesUsed() < 0) {
if (Objects.nonNull(this.bytesUsed()) && this.bytesUsed() < 0) {
throw new IllegalArgumentException(
"`bytesUsed` must be greater than or equal to 0"
);
Expand Down
Loading
Loading