Skip to content

Commit

Permalink
adding "omitempty" and "skip" functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Feb 10, 2021
1 parent 4fcfb51 commit 3dea915
Show file tree
Hide file tree
Showing 85 changed files with 4,184 additions and 1,130 deletions.
85 changes: 38 additions & 47 deletions src/ACL/ACLAuthMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,41 @@
class ACLAuthMethod extends AbstractModel
{
protected const FIELDS = [
self::FIELD_DISPLAY_NAME => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_DESCRIPTION => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_DISPLAY_NAME => Hydration::OMITEMPTY_STRING_FIELD,
self::FIELD_DESCRIPTION => Hydration::OMITEMPTY_STRING_FIELD,
self::FIELD_MAX_TOKEN_TTL => [
Hydration::FIELD_CALLBACK => Hydration::CALLABLE_HYDRATE_DURATION,
],
self::FIELD_TOKEN_LOCALITY => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
Hydration::FIELD_CALLBACK => Hydration::HYDRATE_DURATION,
Hydration::FIELD_OMITEMPTY => true,
],
self::FIELD_TOKEN_LOCALITY => Hydration::OMITEMPTY_STRING_FIELD,
self::FIELD_NAMESPACE_RULES => [
Hydration::FIELD_TYPE => Hydration::ARRAY,
Hydration::FIELD_CLASS => ACLAuthMethodNamespaceRule::class,
Hydration::FIELD_ARRAY_TYPE => Hydration::class,
Hydration::FIELD_OMITEMPTY => true,
],
self::FIELD_NAMESPACE => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_NAMESPACE => Hydration::OMITEMPTY_STRING_FIELD,
];
private const FIELD_DISPLAY_NAME = 'DisplayName';
private const FIELD_DESCRIPTION = 'Description';
private const FIELD_MAX_TOKEN_TTL = 'MaxTokenTTL';
private const FIELD_TOKEN_LOCALITY = 'TokenLocality';
private const FIELD_NAMESPACE_RULES = 'NamespaceRules';
private const FIELD_NAMESPACE = 'Namespace';

private const FIELD_DISPLAY_NAME = 'DisplayName';
private const FIELD_DESCRIPTION = 'Description';
private const FIELD_MAX_TOKEN_TTL = 'MaxTokenTTL';
private const FIELD_TOKEN_LOCALITY = 'TokenLocality';
private const FIELD_NAMESPACE_RULES = 'NamespaceRules';
private const FIELD_NAMESPACE = 'Namespace';

/** @var string */
public string $Name = '';
/** @var string */
public string $Type = '';
/** @var string|null */
public ?string $DisplayName = null;
/** @var string|null */
public ?string $Description = null;
/** @var string */
public string $DisplayName = '';
/** @var string */
public string $Description = '';
/** @var \DCarbone\Go\Time\Duration */
public Time\Duration $MaxTokenTTL;
/** @var string|null */
public ?string $TokenLocality = null;
/** @var string */
public string $TokenLocality = '';
/** @var array */
public array $config = [];
/** @var int */
Expand All @@ -80,8 +71,8 @@ class ACLAuthMethod extends AbstractModel
public int $ModifyIndex = 0;
/** @var \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodNamespaceRule[] */
public array $NamespaceRules = [];
/** @var string|null */
public ?string $Namespace = null;
/** @var string */
public string $Namespace = '';

/**
* ACLAuthMethod constructor.
Expand Down Expand Up @@ -132,36 +123,36 @@ public function setType(string $Type): self
}

/**
* @return string|null
* @return string
*/
public function getDisplayName(): ?string
public function getDisplayName(): string
{
return $this->DisplayName;
}

/**
* @param string|null $DisplayName
* @param string $DisplayName
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
*/
public function setDisplayName(?string $DisplayName): self
public function setDisplayName(string $DisplayName): self
{
$this->DisplayName = $DisplayName;
return $this;
}

/**
* @return string|null
* @return string
*/
public function getDescription(): ?string
public function getDescription(): string
{
return $this->Description;
}

/**
* @param string|null $Description
* @param string $Description
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
*/
public function setDescription(?string $Description): self
public function setDescription(string $Description): self
{
$this->Description = $Description;
return $this;
Expand All @@ -186,18 +177,18 @@ public function setMaxTokenTTL(Time\Duration $MaxTokenTTL): self
}

/**
* @return string|null
* @return string
*/
public function getTokenLocality(): ?string
public function getTokenLocality(): string
{
return $this->TokenLocality;
}

/**
* @param string|null $TokenLocality
* @param string $TokenLocality
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
*/
public function setTokenLocality(?string $TokenLocality): self
public function setTokenLocality(string $TokenLocality): self
{
$this->TokenLocality = $TokenLocality;
return $this;
Expand Down Expand Up @@ -276,18 +267,18 @@ public function setNamespaceRules(array $NamespaceRules): self
}

/**
* @return string|null
* @return string
*/
public function getNamespace(): ?string
public function getNamespace(): string
{
return $this->Namespace;
}

/**
* @param string|null $Namespace
* @param string $Namespace
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethod
*/
public function setNamespace(?string $Namespace): self
public function setNamespace(string $Namespace): self
{
$this->Namespace = $Namespace;
return $this;
Expand Down
116 changes: 89 additions & 27 deletions src/ACL/ACLAuthMethodListEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,29 @@
class ACLAuthMethodListEntry extends AbstractModel
{
protected const FIELDS = [
self::FIELD_DISPLAY_NAME => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_DESCRIPTION => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_NAMESPACE => [
Hydration::FIELD_TYPE => Hydration::STRING,
Hydration::FIELD_NULLABLE => true,
],
self::FIELD_DISPLAY_NAME => Hydration::OMITEMPTY_STRING_FIELD,
self::FIELD_DESCRIPTION => Hydration::OMITEMPTY_STRING_FIELD,
self::FIELD_NAMESPACE => Hydration::OMITEMPTY_STRING_FIELD,
];
private const FIELD_DISPLAY_NAME = 'DisplayName';
private const FIELD_DESCRIPTION = 'Description';
private const FIELD_NAMESPACE = 'Namespace';

private const FIELD_DISPLAY_NAME = 'DisplayName';
private const FIELD_DESCRIPTION = 'Description';
private const FIELD_NAMESPACE = 'Namespace';

/** @var string */
public string $Name = '';
/** @var string */
public string $Type = '';
/** @var string|null */
public ?string $DisplayName = null;
/** @var string|null */
public ?string $Description = null;
/** @var string */
public string $DisplayName = '';
/** @var string */
public string $Description = '';
/** @var int */
public int $CreateIndex = 0;
/** @var int */
public int $ModifyIndex = 0;
/** @var string|null */
public ?string $Namespace = null;
/** @var string */
public string $Namespace = '';

/**
* @return string
Expand All @@ -67,6 +59,16 @@ public function getName(): string
return $this->Name;
}

/**
* @param string $Name
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function setName(string $Name): self
{
$this->Name = $Name;
return $this;
}

/**
* @return string
*/
Expand All @@ -76,21 +78,51 @@ public function getType(): string
}

/**
* @return string|null
* @param string $Type
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function getDisplayName(): ?string
public function setType(string $Type): self
{
$this->Type = $Type;
return $this;
}

/**
* @return string
*/
public function getDisplayName(): string
{
return $this->DisplayName;
}

/**
* @return string|null
* @param string $DisplayName
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function setDisplayName(string $DisplayName): self
{
$this->DisplayName = $DisplayName;
return $this;
}

/**
* @return string
*/
public function getDescription(): ?string
public function getDescription(): string
{
return $this->Description;
}

/**
* @param string $Description
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function setDescription(string $Description): self
{
$this->Description = $Description;
return $this;
}

/**
* @return int
*/
Expand All @@ -99,6 +131,16 @@ public function getCreateIndex(): int
return $this->CreateIndex;
}

/**
* @param int $CreateIndex
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function setCreateIndex(int $CreateIndex): self
{
$this->CreateIndex = $CreateIndex;
return $this;
}

/**
* @return int
*/
Expand All @@ -108,10 +150,30 @@ public function getModifyIndex(): int
}

/**
* @return string|null
* @param int $ModifyIndex
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function getNamespace(): ?string
public function setModifyIndex(int $ModifyIndex): self
{
$this->ModifyIndex = $ModifyIndex;
return $this;
}

/**
* @return string
*/
public function getNamespace(): string
{
return $this->Namespace;
}

/**
* @param string $Namespace
* @return \DCarbone\PHPConsulAPI\ACL\ACLAuthMethodListEntry
*/
public function setNamespace(string $Namespace): self
{
$this->Namespace = $Namespace;
return $this;
}
}
Loading

0 comments on commit 3dea915

Please sign in to comment.