V3 Work#48
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 32 out of 51 changed files in this pull request and generated 2 comments.
Files not reviewed (19)
- src/ACL/ACLAuthMethod.php: Language not supported
- src/ACL/ACLAuthMethodListEntry.php: Language not supported
- src/ACL/ACLAuthMethodListEntryQueryResponse.php: Language not supported
- src/ACL/ACLAuthMethodNamespaceRule.php: Language not supported
- src/ACL/ACLAuthMethodQueryResponse.php: Language not supported
- src/ACL/ACLAuthMethodWriteResponse.php: Language not supported
- src/ACL/ACLBindingRule.php: Language not supported
- src/ACL/ACLBindingRuleQueryResponse.php: Language not supported
- src/ACL/ACLBindingRuleWriteResponse.php: Language not supported
- src/ACL/ACLBindingRulesQueryResponse.php: Language not supported
- src/ACL/ACLClient.php: Language not supported
- src/ACL/ACLEntriesResponse.php: Language not supported
- src/ACL/ACLEntry.php: Language not supported
- src/ACL/ACLLink.php: Language not supported
- src/ACL/ACLLoginParams.php: Language not supported
- src/ACL/ACLNodeIdentity.php: Language not supported
- src/ACL/ACLOIDCAuthURLParams.php: Language not supported
- src/ACL/ACLOIDCCallbackParams.php: Language not supported
- src/ACL/ACLPolicy.php: Language not supported
Comments suppressed due to low confidence (1)
README.md:106
- There appears to be an extra closing bracket in the client instantiation, which may lead to a syntax error in the example code. Consider removing the extra bracket.
$proxyClient = new \GuzzleHttp\Client(['proxy' => 'whatever proxy you want']]);
Contributor
There was a problem hiding this comment.
Copilot reviewed 41 out of 60 changed files in this pull request and generated 1 comment.
Files not reviewed (19)
- src/ACL/ACLAuthMethod.php: Language not supported
- src/ACL/ACLAuthMethodListEntry.php: Language not supported
- src/ACL/ACLAuthMethodListEntryQueryResponse.php: Language not supported
- src/ACL/ACLAuthMethodNamespaceRule.php: Language not supported
- src/ACL/ACLAuthMethodQueryResponse.php: Language not supported
- src/ACL/ACLAuthMethodWriteResponse.php: Language not supported
- src/ACL/ACLBindingRule.php: Language not supported
- src/ACL/ACLBindingRuleQueryResponse.php: Language not supported
- src/ACL/ACLBindingRuleWriteResponse.php: Language not supported
- src/ACL/ACLBindingRulesQueryResponse.php: Language not supported
- src/ACL/ACLClient.php: Language not supported
- src/ACL/ACLEntriesResponse.php: Language not supported
- src/ACL/ACLEntry.php: Language not supported
- src/ACL/ACLLink.php: Language not supported
- src/ACL/ACLLoginParams.php: Language not supported
- src/ACL/ACLNodeIdentity.php: Language not supported
- src/ACL/ACLOIDCAuthURLParams.php: Language not supported
- src/ACL/ACLOIDCCallbackParams.php: Language not supported
- src/ACL/ACLPolicy.php: Language not supported
Comments suppressed due to low confidence (1)
README.md:106
- An extra closing bracket appears in the instantiation of \GuzzleHttp\Client, which may result in a syntax error. Please remove the additional bracket.
$proxyClient = new \GuzzleHttp\Client(['proxy' => 'whatever proxy you want']]);
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Daniel Carbone <daniel.p.carbone@gmail.com>
## Changes
### 1. ACL Token Methods (11 new methods)
Added comprehensive ACL token update methods to AgentClient:
- Legacy methods: UpdateACLToken, UpdateACLAgentToken, UpdateACLAgentMasterToken, UpdateACLReplicationToken
- Modern methods (v1.4+): UpdateDefaultACLToken, UpdateAgentACLToken, UpdateAgentRecoveryACLToken, UpdateAgentMasterACLToken, UpdateReplicationACLToken, UpdateConfigFileRegistrationToken, UpdateDNSToken
- Internal helper: updateToken(string $target, string $token, ?WriteOptions $opts)
- All methods PUT to /v1/agent/token/{target} with JSON body
### 2. Connect Methods (3 new methods)
- ConnectAuthorize(AgentAuthorizeParams): POST /v1/agent/connect/authorize
- ConnectCARoots(?QueryOptions): GET /v1/agent/connect/ca/roots
- ConnectCALeaf(string $serviceID, ?QueryOptions): GET /v1/agent/connect/ca/leaf/{serviceID}
### 3. New Response Types
- AgentAuthorizeResponse: Wraps AgentAuthorize for ConnectAuthorize responses
- ConnectCARootsResponse: Wraps CARootList with QueryMeta
- ConnectCALeafResponse: Wraps LeafCert with QueryMeta
### 4. New Model Types
- CARoot: Individual CA root certificate model with time parsing
- CARootList: Collection of CA roots
- LeafCert: Leaf certificate model with time parsing
### 5. QueryOptions Variants (13 new methods)
Added *Opts variants supporting QueryOptions parameter:
- ChecksWithFilterOpts, ServicesWithFilterOpts
- AgentHealthServiceByIDOpts, AgentHealthServiceByNameOpts
- ServiceDeregisterOpts, UpdateTTLOpts
- CheckRegisterOpts, CheckDeregisterOpts
- EnableServiceMaintenanceOpts, DisableServiceMaintenanceOpts
- EnableNodeMaintenanceOpts, DisableNodeMaintenanceOpts
- ForceLeaveOpts, ForceLeaveOptions (alias)
### 6. Version Method
- Version(): Returns MapResponse with agent version information
### 7. MembersOpts Rename
- Renamed MemberOpts class to MembersOpts with expanded features
- Maintained backward compatibility via MemberOpts extends MembersOpts alias
- MembersOpts() method added, MemberOpts() delegates to MembersOpts()
### 8. Comprehensive Testing
- Added AgentClientTest.php with parameterized tests for all methods
- Added unit tests for all new response types (AgentAuthorizeResponseTest, ConnectCARootsResponseTest, ConnectCALeafResponseTest)
- Added unit tests for all new model types (CARootTest, CARootListTest, LeafCertTest)
- Added MembersOptsTest to verify renamed class
- Updated MemberOptsTest for backward compatibility
- Updated integration tests to use new MembersOpts
All tests pass:
✅ PHPUnit: 1252 tests, 5182 assertions
✅ PHPStan: No errors
✅ Psalm: No errors
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hods This refactoring eliminates redundant *Opts method variants by consolidating them into single methods with optional QueryOptions parameters. This results in a cleaner, more intuitive API while maintaining full backward compatibility. REMOVED METHODS (13 total): - ChecksWithFilter, ChecksWithFilterOpts - ServicesWithFilter, ServicesWithFilterOpts - AgentHealthServiceByIDOpts - AgentHealthServiceByNameOpts - ServiceDeregisterOpts - UpdateTTLOpts - CheckRegisterOpts - CheckDeregisterOpts - EnableServiceMaintenanceOpts - DisableServiceMaintenanceOpts - EnableNodeMaintenanceOpts - DisableNodeMaintenanceOpts MODIFIED METHODS (12 total): - Checks(string $filter = '', ?QueryOptions $opts = null) - Services(string $filter = '', ?QueryOptions $opts = null) - AgentHealthServiceByID(string $id, ?QueryOptions $opts = null) - AgentHealthServiceByName(string $service, ?QueryOptions $opts = null) - ServiceDeregister(string $serviceID, ?QueryOptions $opts = null) - UpdateTTL(string $checkID, string $output, string $status, ?QueryOptions $opts = null) - CheckRegister(AgentCheckRegistration $check, ?QueryOptions $opts = null) - CheckDeregister(string $checkID, ?QueryOptions $opts = null) - EnableServiceMaintenance(string $serviceID, string $reason = '', ?QueryOptions $opts = null) - DisableServiceMaintenance(string $serviceID, ?QueryOptions $opts = null) - EnableNodeMaintenance(string $reason = '', ?QueryOptions $opts = null) - DisableNodeMaintenance(?QueryOptions $opts = null) OPTIMIZED METHODS: - ForceLeave now consolidates ForceLeave, ForceLeavePrune, ForceLeaveOpts, and ForceLeaveOptions into: ForceLeave(string $node, ?ForceLeaveOpts $opts = null, ?QueryOptions $qOpts = null) BENEFITS: - Reduced method count by ~30% - Eliminated code duplication - Cleaner, more intuitive API - No loss of functionality - Full backward compatibility for base method names CHANGES: - 129 lines removed from AgentClient.php (42 insertions, 171 deletions) - Updated unit tests to use consolidated methods - Updated integration tests to use new method signatures - All tests pass (211 unit tests, 0 failures) - PhpStan: OK (no errors) - Psalm: OK (no errors) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Created 16 comprehensive unit tests for KVClient covering all methods - Tests validate Get, List, Keys, Put, CAS, Acquire, Release, Delete, DeleteCAS, DeleteTree, and Txn methods - All tests pass with mock HTTP responses - Tests verify response types and state transitions - Total: 75 unit tests now pass for KV namespace Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goals:
FakeMapclass.FakeSliceclass.ScalarTypeinterface.Transcodingtype and usage.UnmarshallerandMarshallertraits and flow.Time\Durationvalues to acceptnull|int|float|string|\DateInterval|Time\Durationfor construction.enumtypes for enum values.