diff --git a/README.md b/README.md index 0680443..dabd650 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ A PHP SDK for integrating with the [Veeam Service Provider Console (VSPC)](https ## Features - Guzzle-based HTTP client preconfigured for the VSPC REST endpoints. -- Repository classes mirroring the API tags (Authentication, Companies, Backup Servers, and more). +- Repository classes mirroring the API tags (Alarms, Authentication, Backup Agents, Backup Policies, Backup Server Jobs, Backup Servers, Cloud Connect, Companies, Licensing, Locations, Management Agents, Misc, Organizations, Provider, Pulse, Microsoft 365, and more). - Fluent payload builders to compose request bodies for complex operations. +- `GenericPayload` helper to quickly serialize ad-hoc request bodies when a dedicated builder is not required. - Helpers for filters, pagination, and query parameters. - Returns PSR-7 responses or decoded JSON payloads for convenience. @@ -66,6 +67,23 @@ $response = $client->jsonResponse($request); Repositories accept optional filters and query parameters when executed through `VeeamSPCClient::send()` or `VeeamSPCClient::jsonResponse()`. You can build complex filters using `Filter` and `FilterCollection` helpers located under `Shellrent\VeeamVspcApiClient\Support`. +### Send an Ad-hoc JSON Body +When an endpoint requires a request body that does not yet have a dedicated payload builder, you can rely on the `GenericPayload` helper. Pass an array (automatically encoded as JSON) or a raw string together with the desired content type. + +```php +use Shellrent\VeeamVspcApiClient\Payloads\GenericPayload; +use Shellrent\VeeamVspcApiClient\Repositories\BackupPolicyRepository; + +$payload = new GenericPayload([ + 'Name' => 'My Custom Policy', + 'Description' => 'Created through the SDK', +]); + +$backupPolicyRepository = new BackupPolicyRepository(); +$request = $backupPolicyRepository->createWindowsBackupPolicy($payload); +$response = $client->jsonResponse($request); +``` + ## OpenAPI Specification The official VSPC OpenAPI definition used to generate the SDK is stored in [`openapi/3.5.1/vspc-api.json`](openapi/3.5.1/vspc-api.json). Refer to it for a complete list of available operations, parameters, and payload schemas. diff --git a/src/Payloads/GenericPayload.php b/src/Payloads/GenericPayload.php new file mode 100644 index 0000000..424547d --- /dev/null +++ b/src/Payloads/GenericPayload.php @@ -0,0 +1,22 @@ +body = is_array( $body ) ? json_encode( $body ) : $body; + $this->contentType = $contentType; + } + + public function getBody() { + return $this->body; + } + + public function getContentType(): string { + return $this->contentType; + } +} diff --git a/src/Payloads/ModifyLicenseManagedInVCSPPulsePayload.php b/src/Payloads/ModifyLicenseManagedInVCSPPulsePayload.php index 4d74ebb..5b4b2fd 100755 --- a/src/Payloads/ModifyLicenseManagedInVCSPPulsePayload.php +++ b/src/Payloads/ModifyLicenseManagedInVCSPPulsePayload.php @@ -5,11 +5,24 @@ class ModifyLicenseManagedInVCSPPulsePayload implements Payload { protected string $AssignedCompanyUid; - protected array $Modifiers; + protected array $Modifiers = []; + + /** + * @var array> + */ + protected array $Workloads = []; public function getBody() { $body = $this->Modifiers; + foreach ( $this->Workloads as $workload ) { + $body[] = [ + 'value' => $workload['count'], + 'path' => '/workloads/' . $workload['index'] . '/count', + 'op' => 'replace' + ]; + } + return json_encode( $body ); } @@ -23,6 +36,15 @@ public function assignedCompanyUid( string $companyUid ) { return $this; } + public function addWorkloadCount( $workloadIndex, $count ) { + $this->Workloads[] = [ + 'index' => $workloadIndex, + 'count' => $count, + ]; + + return $this; + } + public function expirationDate( string $isoDate ): ModifyLicenseManagedInVCSPPulsePayload { $this->Modifiers[] = [ 'value' => $isoDate, diff --git a/src/Repositories/AlarmRepository.php b/src/Repositories/AlarmRepository.php index d5b5e7e..8ee50b1 100755 --- a/src/Repositories/AlarmRepository.php +++ b/src/Repositories/AlarmRepository.php @@ -2,36 +2,141 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; +use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class AlarmRepository implements Repository { + use CreateDeleteRequest; use CreateGetRequest; - use CreatePostRequest; - + public function getBaseRoute(): string { return 'alarms'; } - - public function getAllTriggeredAlarms(): RequestBuilder { - return $this->createGetRequest( '/active' ); - } - - public function getAllAlarmTemplates(): RequestBuilder { - return $this->createGetRequest( '/templates' ); - } - - public function postResolveAlarm( string $alarmUid, string $comment = ' ' ): RequestBuilder { - return $this->createPostRequest( sprintf( '/active/%s/resolve', $alarmUid ) ) - ->query( [ - 'comment' => $comment, - 'resolveOnClients' => 'true', - ] ); - } - - public function getAlarmStatusChanges( string $alarmUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/templates/%s/events', $alarmUid ) ); + + /** + * Get All Triggered Alarms Returns collection resource representation of all Veeam Service Provider Console triggered alarms. + * Path: /alarms/active + */ + public function getActiveAlarms(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/active'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Triggered Alarm Deletes a triggered alarm with the specified UID. + * Path: /alarms/active/{activeAlarmUid} + */ + public function deleteActiveAlarm(string $activeAlarmUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/active/%s', $activeAlarmUid )); + } + + /** + * Get Triggered Alarm Returns a resource representation of a triggered alarm with the specified UID. + * Path: /alarms/active/{activeAlarmUid} + */ + public function getActiveAlarm(string $activeAlarmUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/active/%s', $activeAlarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Acknowledge Triggered Alarm Assigns the Acknowledged status to a triggered alarm with the specified UID. + * Path: /alarms/active/{activeAlarmUid}/acknowledge + */ + public function acknowledgeActiveAlarm(string $activeAlarmUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/active/%s/acknowledge', $activeAlarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Triggered Alarm History Returns a collection resource representation of all status changes of a triggered alarm with the specified UID in chronological order. + * Path: /alarms/active/{activeAlarmUid}/history + */ + public function getActiveAlarmHistory(string $activeAlarmUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/active/%s/history', $activeAlarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Resolve Triggered Alarm Resolves a triggered alarm with the specified UID. + * Path: /alarms/active/{activeAlarmUid}/resolve + */ + public function resolveActiveAlarm(string $activeAlarmUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/active/%s/resolve', $activeAlarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Alarm Templates Returns a collection resource representation of all Veeam Service Provider Console alarm templates. + * Path: /alarms/templates + */ + public function getAlarms(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/templates'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Alarm Template Deletes an alarm template with the specified UID. + * Path: /alarms/templates/{alarmUid} + */ + public function deleteAlarm(string $alarmUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/templates/%s', $alarmUid )); + } + + /** + * Get Alarm Template Returns a resource representation of an alarm template with the specified UID. + * Path: /alarms/templates/{alarmUid} + */ + public function getAlarm(string $alarmUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/templates/%s', $alarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Clone Alarm Template Creates a clone of an alarm template with the specified UID. + * Path: /alarms/templates/{alarmUid}/clone + */ + public function cloneAlarm(string $alarmUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/templates/%s/clone', $alarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Alarm Status Changes Returns all status changes of a triggered alarm with the specified template UID. + * Path: /alarms/templates/{alarmUid}/events + */ + public function getActiveAlarmsByAlarm(string $alarmUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/templates/%s/events', $alarmUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/AuthenticationRepository.php b/src/Repositories/AuthenticationRepository.php index e0d9018..9a3c6ce 100755 --- a/src/Repositories/AuthenticationRepository.php +++ b/src/Repositories/AuthenticationRepository.php @@ -2,18 +2,126 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; -use Shellrent\VeeamVspcApiClient\Payloads\OAuthPayload; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; +use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class AuthenticationRepository implements Repository { + use CreateGetRequest; + use CreatePatchRequest; use CreatePostRequest; - + public function getBaseRoute(): string { return ''; } - - public function postOAuthAuthentication( OAuthPayload $payload ): RequestBuilder { - return $this->createPostRequest( '/token', $payload ); + + /** + * Obtain Tokens for Decrypted Challenge Issues access and refresh tokens in response to a decrypted challenge. > Operation is deprecated. We recommend to authorize using the `/token` endpoint. + * Path: /authentication/asymmetricalgorithm + */ + public function asymmetricAlgorithmCompleteChallenge(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest('/authentication/asymmetricalgorithm', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Generate Asymmetric Authentication Challenge Generates a decryption challenge for the specified public key. The challenge must be decrypted in 30 seconds. > Operation is deprecated. We recommend to authorize using the `/users/{userUid}/logins/apikey` or `/token` endpoint. + * Path: /authentication/asymmetricalgorithm + */ + public function asymmetricAlgorithmChallenge(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/authentication/asymmetricalgorithm', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Obtain RSA Keys Issues an RSA key pair. > You can specify the key size if needed. + * Path: /authentication/keys/rsa + */ + public function generateNewRsaKeyPair(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/authentication/keys/rsa'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Issues a PKCS#12 container with an RSA private key and an X.509 certificate. + * Path: /authentication/keys/rsa-pkcs12 + */ + public function generateNewPkcs12KeyPair(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/authentication/keys/rsa-pkcs12'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Decrypts an encrypted PKCS#12 container. > If container does not include private key the server will return an error with the `1210` code. + * Path: /authentication/keys/rsa-pkcs12/decrypt + */ + public function decryptPkcs12Container(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/authentication/keys/rsa-pkcs12/decrypt', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Obtain TOTP Secret Issues a TOTP secret and a URL-encoded secret. + * Path: /authentication/keys/totp-secret + */ + public function generateTotpSecret(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/authentication/keys/totp-secret'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Obtain New Pair of Tokens Returns access and refresh tokens in response to refresh token. > Operation is deprecated. We recommend to authorize using the `/token` endpoint. + * Path: /authentication/refresh + */ + public function refreshTokenAuthenticate(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/authentication/refresh', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Authenticate with User Name and Password Issues access and refresh tokens for the specified user name and password. > Operation is deprecated. We recommend to authorize using the `/token` endpoint. + * Path: /authentication/usernamepassword + */ + public function usernamePasswordAuthenticate(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/authentication/usernamepassword', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * OAuth 2.0 Authentication Performs authentication using the OAuth 2.0 Authorization Framework. + * Path: /token + */ + public function oAuth2IssueToken(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/token', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/BackupAgentJobRepository.php b/src/Repositories/BackupAgentJobRepository.php new file mode 100644 index 0000000..c48be36 --- /dev/null +++ b/src/Repositories/BackupAgentJobRepository.php @@ -0,0 +1,346 @@ +createGetRequest('/jobs'); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Start Veeam Backup Agent Job Starts a Veeam backup agent job with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/{backupAgentUid}/jobs/{backupAgentJobUid}/start + */ + public function startBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/%s/jobs/%s/start', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Stop Veeam Backup Agent Job Stops a Veeam backup agent job with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/{backupAgentUid}/jobs/{backupAgentJobUid}/stop + */ + public function stopBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/%s/jobs/%s/stop', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Get Jobs for All Veeam Agents for Microsoft Windows Returns a collection resource representation of all Veeam backup agent jobs protecting Windows computers. + * Path: /infrastructure/backupAgents/windows/jobs + */ + public function getWindowsBackupAgentJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/windows/jobs'); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get All Jobs for Veeam Agent for Microsoft Windows Returns a collection resource representation of all jobs configured for Veeam backup agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs + */ + public function getWindowsBackupAgentJobsByAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/windows/%s/jobs', $backupAgentUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get Job for Veeam Agent for Microsoft Windows Returns a resource representation of a Veeam Agent for Microsoft Windows job with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function getWindowsBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/windows/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Delete Job for Veeam Agent for Microsoft Windows Deletes a Veeam Agent for Microsoft Windows job with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function deleteWindowsBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, bool $removeRestorePoints, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf('/windows/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + $request->query(array_merge([ + 'removeRestorePoints' => $removeRestorePoints ? 'true' : 'false', + ], $query)); + + return $request; + } + + /** + * Modify Job for Veeam Agent for Microsoft Windows Modifies a Veeam Agent for Microsoft Windows job with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function patchWindowsBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf('/windows/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid), $payload); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Start Job for Veeam Agent for Microsoft Windows Starts a Veeam Agent for Microsoft Windows job with the specified UID. Returns a positive response when the management agent receives the reboot task and not when the task is executed. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid}/start + */ + public function startWindowsBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/windows/%s/jobs/%s/start', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Stop Job for Veeam Agent for Microsoft Windows Stops a Veeam Agent for Microsoft Windows job with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid}/stop + */ + public function stopWindowsBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/windows/%s/jobs/%s/stop', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Get Configuration of Job for Veeam Agent for Microsoft Windows Returns a resource representation of a configuration of the Veeam Agent for Microsoft Windows job with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid}/configuration + */ + public function getWindowsBackupAgentJobConfiguration(string $backupAgentUid, string $backupAgentJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/windows/%s/jobs/%s/configuration', $backupAgentUid, $backupAgentJobUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Modify Configuration of Job for Veeam Agent for Microsoft Windows Modifies a configuration of the Veeam Agent for Microsoft Windows job with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/{backupAgentJobUid}/configuration + */ + public function patchWindowsBackupAgentJobConfiguration(string $backupAgentUid, string $backupAgentJobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf('/windows/%s/jobs/%s/configuration', $backupAgentUid, $backupAgentJobUid), $payload); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Create Configuration of Job for Veeam Agent for Microsoft Windows Creates a configuration of a Veeam backup agent job protecting a Windows computer with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/jobs/configuration + */ + public function createWindowsBackupAgentJobConfiguration(string $backupAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf('/windows/%s/jobs/configuration', $backupAgentUid), $payload); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get Jobs for All Veeam Agents for Linux Returns a collection resource representation of all Veeam Agent jobs protecting Linux computers. + * Path: /infrastructure/backupAgents/linux/jobs + */ + public function getLinuxBackupAgentJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/linux/jobs'); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get All Jobs for Veeam Agent for Linux Returns a collection resource representation of all jobs configured for a Veeam Agent for Linux with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs + */ + public function getLinuxBackupAgentJobsByAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/linux/%s/jobs', $backupAgentUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get Job for Veeam Agent for Linux Returns a resource representation of a Veeam Agent for Linux job with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function getLinuxBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/linux/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Delete Job for Veeam Agent for Linux Deletes a Veeam Agent for Linux job with the specified UID. Returns a positive response if the restart task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function deleteLinuxBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, bool $removeRestorePoints, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf('/linux/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + $request->query(array_merge([ + 'removeRestorePoints' => $removeRestorePoints ? 'true' : 'false', + ], $query)); + + return $request; + } + + /** + * Start Job for Veeam Agent for Linux Starts a Veeam Agent for Linux job with the specified UID. Returns a positive response if the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid}/start + */ + public function startLinuxBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/linux/%s/jobs/%s/start', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Stop Job for Veeam Agent for Linux Stops a Veeam Agent for Linux job with the specified UID. Returns a positive response if the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid}/stop + */ + public function stopLinuxBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/linux/%s/jobs/%s/stop', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Get Configuration of Job for Veeam Agent for Linux Returns a resource representation of Veeam Agent for Linux job configuration with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid}/configuration + */ + public function getLinuxBackupAgentJobConfiguration(string $backupAgentUid, string $backupAgentJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/linux/%s/jobs/%s/configuration', $backupAgentUid, $backupAgentJobUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Modify Configuration of Job for Veeam Agent for Linux Modifies Veeam Agent for Linux job configuration with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/{backupAgentJobUid}/configuration + */ + public function patchLinuxBackupAgentJobConfiguration(string $backupAgentUid, string $backupAgentJobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf('/linux/%s/jobs/%s/configuration', $backupAgentUid, $backupAgentJobUid), $payload); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Create Configuration of Job for Veeam Agent for Linux Creates configuration of a Veeam backup agent job protecting Linux computer with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/jobs/configuration + */ + public function createLinuxBackupAgentJobConfiguration(string $backupAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf('/linux/%s/jobs/configuration', $backupAgentUid), $payload); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get Jobs for All Veeam Agents for Mac Returns a collection resource representation of all Veeam Agent for Mac jobs. + * Path: /infrastructure/backupAgents/mac/jobs + */ + public function getMacBackupAgentJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/mac/jobs'); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get All Jobs for Veeam Agent for Mac Returns a collection resource representation of all jobs configured for Veeam Agent for Mac with the specified UID. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/jobs + */ + public function getMacBackupAgentJobsByAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/mac/%s/jobs', $backupAgentUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Get Job for Veeam Agent for Mac Returns a resource representation of a Veeam Agent for Mac job with the specified UID. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function getMacBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf('/mac/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + if ($query !== []) { + $request->query($query); + } + + return $request; + } + + /** + * Delete Job for Veeam Agent for Mac Deletes a Veeam Agent for Mac job with the specified UID. Returns a positive response if the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/jobs/{backupAgentJobUid} + */ + public function deleteMacBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid, bool $removeRestorePoints, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf('/mac/%s/jobs/%s', $backupAgentUid, $backupAgentJobUid)); + $request->query(array_merge([ + 'removeRestorePoints' => $removeRestorePoints ? 'true' : 'false', + ], $query)); + + return $request; + } + + /** + * Start Job for Veeam Agent for Mac Starts a Veeam Agent for Mac job with the specified UID. Returns a positive response if the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/jobs/{backupAgentJobUid}/start + */ + public function startMacBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/mac/%s/jobs/%s/start', $backupAgentUid, $backupAgentJobUid)); + } + + /** + * Stop Job for Veeam Agent for Mac Stops a Veeam Agent for Mac job with the specified UID. Returns a positive response if the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/jobs/{backupAgentJobUid}/stop + */ + public function stopMacBackupAgentJob(string $backupAgentUid, string $backupAgentJobUid): RequestBuilder { + return $this->createPostRequest(sprintf('/mac/%s/jobs/%s/stop', $backupAgentUid, $backupAgentJobUid)); + } +} + diff --git a/src/Repositories/BackupAgentRepository.php b/src/Repositories/BackupAgentRepository.php index 14c6dd8..368ea81 100755 --- a/src/Repositories/BackupAgentRepository.php +++ b/src/Repositories/BackupAgentRepository.php @@ -2,28 +2,342 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePutRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class BackupAgentRepository implements Repository { + use CreateDeleteRequest; use CreateGetRequest; + use CreatePatchRequest; + use CreatePostRequest; + use CreatePutRequest; - use CreateDeleteRequest; - public function getBaseRoute(): string { return 'infrastructure/backupAgents'; } - - public function getAll(): RequestBuilder { - return $this->createGetRequest( '' ); + + /** + * Get All Backup Agents Returns a collection resource representation of all Veeam backup agents. + * Path: /infrastructure/backupAgents + */ + public function getBackupAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Agents for Linux Returns a collection resource representation of all Veeam Agents for Linux. + * Path: /infrastructure/backupAgents/linux + */ + public function getLinuxBackupAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/linux'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Policies Assigned to All Veeam Agents for Linux Returns a collection resource representation of all backup policies assigned to Veeam Agents for Linux. + * Path: /infrastructure/backupAgents/linux/assignedPolicies + */ + public function getAllLinuxBackupAgentAssignedPolicies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/linux/assignedPolicies'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function delete( string $backupAgentUid ) { - return $this->createDeleteRequest( '/' . $backupAgentUid ); + + /** + * Get Veeam Agent for Linux Returns a resource representation of a Veeam Agent for Linux with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid} + */ + public function getLinuxBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/linux/%s', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllVeeamBackupAgentJobs(): RequestBuilder { - return $this->createGetRequest( '/jobs' ); + + /** + * Get All Policies Assigned to Veeam Agent for Linux Returns a collection resource representation of all backup policies assigned to a Veeam Agent for Linux with the specified UID. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/assignedPolicies + */ + public function getLinuxBackupAgentAssignedPolicies(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/linux/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Assign Policy to Veeam Agent for Linux Assigns a backup policy to a Veeam Agent for Linux with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/linux/{backupAgentUid}/assignedPolicies + */ + public function assignLinuxPolicyOnBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/linux/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Agents for Mac Returns a collection resource representation of all Veeam Agents for Mac. + * Path: /infrastructure/backupAgents/mac + */ + public function getMacBackupAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/mac'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Policies Assigned to All Veeam Agents for Mac Returns a collection resource representation of all backup policies assigned to Veeam Agents for Mac. + * Path: /infrastructure/backupAgents/mac/assignedPolicies + */ + public function getAllMacBackupAgentAssignedPolicies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/mac/assignedPolicies'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Agent for Mac Returns a resource representation of a Veeam Agent for Mac with the specified UID. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid} + */ + public function getMacBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/mac/%s', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Policies Assigned to Veeam Agent for Mac Returns a collection resource representation of all backup policies assigned to a Veeam Agent for Mac with the specified UID. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/assignedPolicies + */ + public function getMacBackupAgentAssignedPolicies(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/mac/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Assign Policy to Veeam Agent for Mac Assigns a backup policy to a Veeam Agent for Mac with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/mac/{backupAgentUid}/assignedPolicies + */ + public function assignMacPolicyOnBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/mac/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Agents for Microsoft Windows Returns a collection resource representation of all Veeam backup agents installed on Windows computers. + * Path: /infrastructure/backupAgents/windows + */ + public function getWindowsBackupAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/windows'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Policies Assigned to All Veeam Agents for Microsoft Windows Returns a collection resource representation of all backup policies assigned to Veeam Agents for Microsoft Windows. + * Path: /infrastructure/backupAgents/windows/assignedPolicies + */ + public function getAllBackupAgentAssignedPolicies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/windows/assignedPolicies'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Agents for Microsoft Windows Settings Returns a collection resource representation of settings configured for all Veeam backup agents installed on Windows computers. + * Path: /infrastructure/backupAgents/windows/settings + */ + public function getBackupAgentsSettings(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/windows/settings'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Agent for Microsoft Windows Returns a resource representation of a Veeam Agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid} + */ + public function getWindowsBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/windows/%s', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Policies Assigned to Veeam Agent for Microsoft Windows Returns a collection resource representation of all backup policies assigned to Veeam Agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/assignedPolicies + */ + public function getBackupAgentAssignedPolicies(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/windows/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Assign Policy to Veeam Agent for Microsoft Windows Assigns a backup policy to a Veeam Agent for Microsoft Windows with the specified UID. Returns a positive response when the management agent receives the task and not when the task is executed. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/assignedPolicies + */ + public function assignPolicyOnBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/windows/%s/assignedPolicies', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Install CBT Driver Installs the Veeam CBT driver on a Windows computer that runs Veeam Agent with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/installCbtDriver + */ + public function installCbtDriver(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/windows/%s/installCbtDriver', $backupAgentUid )); + } + + /** + * Get Veeam Agent for Microsoft Windows Settings Returns a resource representation of settings configured for Veeam Agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/settings + */ + public function getBackupAgentSettings(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/windows/%s/settings', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Veeam Agent for Microsoft Windows Settings Modifies settings configured for Veeam Agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/settings + */ + public function patchBackupAgentSettings(string $backupAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/windows/%s/settings', $backupAgentUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Replace Veeam Agent for Microsoft Windows Settings Replaces settings configured for Veeam Agent for Microsoft Windows with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/settings + */ + public function setBackupAgentSettings(string $backupAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/windows/%s/settings', $backupAgentUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Uninstall CBT Driver Uninstalls the Veeam CBT driver from a Windows computer that runs Veeam Agent with the specified UID. + * Path: /infrastructure/backupAgents/windows/{backupAgentUid}/uninstallCbtDriver + */ + public function uninstallCbtDriver(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/windows/%s/uninstallCbtDriver', $backupAgentUid )); + } + + /** + * Delete Backup Agent Deletes Veeam backup agent with the specified UID. + * Path: /infrastructure/backupAgents/{backupAgentUid} + */ + public function deleteBackupAgent(string $backupAgentUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s', $backupAgentUid )); + } + + /** + * Get Backup Agent Returns a resource representation of a Veeam backup agent with the specified UID. + * Path: /infrastructure/backupAgents/{backupAgentUid} + */ + public function getBackupAgent(string $backupAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s', $backupAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Backup Agent Modifies Veeam backup agent with the specified UID. + * Path: /infrastructure/backupAgents/{backupAgentUid} + */ + public function patchBackupAgent(string $backupAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s', $backupAgentUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Activate Backup Agent Changes management mode of a Veeam backup agent with the specified UID to ManagedByConsole. + * Path: /infrastructure/backupAgents/{backupAgentUid}/activate + */ + public function activateBackupAgent(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/activate', $backupAgentUid )); + } + + /** + * Force Data Collection from Backup Agent Forces data collection from a Veeam backup agent with the specified UID. Returns a positive response when the management agent receives the data collection task and not when the task is executed. + * Path: /infrastructure/backupAgents/{backupAgentUid}/collect + */ + public function forceCollectBackupAgent(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/collect', $backupAgentUid )); + } + + /** + * Deactivate Backup Agent Changes management mode of Veeam backup agent with the specified UID to UnManaged and deletes management agent from the agent computer. + * Path: /infrastructure/backupAgents/{backupAgentUid}/deactivate + */ + public function deactivateBackupAgent(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/deactivate', $backupAgentUid )); + } + + /** + * Restart Backup Agent Restarts Veeam backup agent with the specified UID. Returns a positive response if the restart task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupAgents/{backupAgentUid}/restart + */ + public function restartBackupAgentService(string $backupAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/restart', $backupAgentUid )); } } diff --git a/src/Repositories/BackupPolicyRepository.php b/src/Repositories/BackupPolicyRepository.php new file mode 100644 index 0000000..5e0605c --- /dev/null +++ b/src/Repositories/BackupPolicyRepository.php @@ -0,0 +1,185 @@ +createGetRequest('/backupPolicies'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Policies for Linux Computers Returns a collection resource representation of all backup policies configured for Linux computers. + * Path: /configuration/backupPolicies/linux + */ + public function getLinuxBackupPolicies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/backupPolicies/linux'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Backup Policy for Linux Computers Creates a backup policy for Linux computers. + * Path: /configuration/backupPolicies/linux + */ + public function createLinuxBackupPolicy(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/backupPolicies/linux', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Policy for Linux Computers Returns a resource representation of a Linux computer backup policy with the specified UID. + * Path: /configuration/backupPolicies/linux/{policyUid} + */ + public function getLinuxBackupPolicy(string $policyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/backupPolicies/linux/%s', $policyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Backup Policy for Linux Computers Modifies a Linux computer backup policy with the specified UID. + * Path: /configuration/backupPolicies/linux/{policyUid} + */ + public function patchLinuxBackupPolicy(string $policyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/backupPolicies/linux/%s', $policyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Policies for Windows Computers Returns a collection resource representation of all backup policies configured for Microsoft Windows computers. + * Path: /configuration/backupPolicies/windows + */ + public function getWindowsBackupPolicies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/backupPolicies/windows'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Backup Policy for Windows Computers Creates a backup policy for Microsoft Windows computers. + * Path: /configuration/backupPolicies/windows + */ + public function createWindowsBackupPolicy(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/backupPolicies/windows', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Policy for Windows Computers Returns a resource representation of a Windows computer backup policy with the specified UID. + * Path: /configuration/backupPolicies/windows/{policyUid} + */ + public function getWindowsBackupPolicy(string $policyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/backupPolicies/windows/%s', $policyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Backup Policy for Windows Computers Modifies a Windows computer backup policy with the specified UID. + * Path: /configuration/backupPolicies/windows/{policyUid} + */ + public function patchWindowsBackupPolicy(string $policyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/backupPolicies/windows/%s', $policyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Backup Policy Deletes a backup policy with the specified UID. + * Path: /configuration/backupPolicies/{policyUid} + */ + public function deleteBackupPolicy(string $policyUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/backupPolicies/%s', $policyUid )); + } + + /** + * Get Backup Policy Returns a resource representation of a backup policy with the specified UID. + * Path: /configuration/backupPolicies/{policyUid} + */ + public function getBackupPolicy(string $policyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/backupPolicies/%s', $policyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Backup Policy Modifies a backup policy with the specified UID. + * Path: /configuration/backupPolicies/{policyUid} + */ + public function patchBackupPolicy(string $policyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/backupPolicies/%s', $policyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Copy Backup Policy Creates a copy of a backup policy with the specified UID. + * Path: /configuration/backupPolicies/{policyUid}/copy + */ + public function copyBackupPolicy(string $policyUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/backupPolicies/%s/copy', $policyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Available Backup Policies Returns a collection resource representation of all backup policies that can be assigned to agents. + * Path: /configuration/backupPoliciesToAssign + */ + public function getBackupPoliciesToAssign(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/backupPoliciesToAssign'); + if ($query !== []) { + $request->query($query); + } + return $request; + } +} diff --git a/src/Repositories/BackupServerJobRepository.php b/src/Repositories/BackupServerJobRepository.php new file mode 100644 index 0000000..2070b75 --- /dev/null +++ b/src/Repositories/BackupServerJobRepository.php @@ -0,0 +1,1073 @@ +createGetRequest('/jobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Agent Jobs Returns a collection resource representation of all backup agent jobs. + * Path: /infrastructure/backupServers/jobs/agentJobs + */ + public function getBackupServerAgentJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/agentJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Backup Agent Jobs Returns a collection resource representation of all backup agent job objects. + * Path: /infrastructure/backupServers/jobs/agentJobs/objects + */ + public function getBackupServerAgentJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/agentJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Agent Job Returns a resource representation of a backup agent job with the specified UID. + * Path: /infrastructure/backupServers/jobs/agentJobs/{jobUid} + */ + public function getBackupServerAgentJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/agentJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Backup Agent Job Returns a collection resource representation of all objects of a backup agent job with the specified UID. + * Path: /infrastructure/backupServers/jobs/agentJobs/{jobUid}/objects + */ + public function getBackupServerAgentJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/agentJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Periodic Backup Copy Jobs Returns a collection resource representation of all periodic backup copy and legacy periodic backup copy jobs. + * Path: /infrastructure/backupServers/jobs/backupCopyJobs + */ + public function getBackupServerBackupCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Periodic Backup Copy Jobs Returns a collection resource representation of objects of all periodic backup copy and legacy periodic backup copy jobs. + * Path: /infrastructure/backupServers/jobs/backupCopyJobs/jobObjects + */ + public function getBackupServerBackupCopyJobsLinkedJobObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupCopyJobs/jobObjects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Periodic Backup Copy Job Returns a resource representation of a periodic backup copy or legacy periodic backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupCopyJobs/{jobUid} + */ + public function getBackupServerBackupCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Periodic Backup Copy Job Returns a collection resource representation of all objects of a periodic backup copy or legacy periodic backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupCopyJobs/{jobUid}/jobObjects + */ + public function getBackupServerBackupCopyJobLinkedJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupCopyJobs/%s/jobObjects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup to Tape Jobs Returns a collection resource representation of all backup to tape jobs. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs + */ + public function getBackupServerBackupTapeJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupTapeJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Job Objects of Backup to Tape Jobs Returns a collection resource representation of all jobs processed by backup to tape jobs. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs/jobObjects + */ + public function getBackupServerBackupTapeJobsLinkedJobObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupTapeJobs/jobObjects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Repository Objects of Backup to Tape Jobs Returns a collection resource representation of all repositories processed by backup to tape jobs. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs/repositoryObjects + */ + public function getBackupServerBackupTapeJobsLinkedRepositoryObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupTapeJobs/repositoryObjects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup to Tape Job Returns a resource representation of a backup to tape job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs/{jobUid} + */ + public function getBackupServerBackupTapeJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupTapeJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Job Objects of Backup to Tape Job Returns a collection resource representation of all jobs processed by a backup to tape job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs/{jobUid}/jobObjects + */ + public function getBackupServerBackupTapeJobLinkedJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupTapeJobs/%s/jobObjects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Repository Objects of Backup to Tape Job Returns a collection resource representation of all repositories processed by a backup to tape job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupTapeJobs/{jobUid}/repositoryObjects + */ + public function getBackupServerBackupTapeJobLinkedRepositoryObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupTapeJobs/%s/repositoryObjects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Backup Jobs Returns a collection resource representation of all backup jobs that protect VMs. + * Path: /infrastructure/backupServers/jobs/backupVmJobs + */ + public function getBackupServerBackupVmJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupVmJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Backup Jobs Returns a collection resource representation of all VM backup job objects. + * Path: /infrastructure/backupServers/jobs/backupVmJobs/objects + */ + public function getBackupServerBackupVmJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/backupVmJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VM Backup Job Returns a resource representation of a backup job with the specified UID that protects VMs. + * Path: /infrastructure/backupServers/jobs/backupVmJobs/{jobUid} + */ + public function getBackupServerBackupVmJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupVmJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Backup Job Returns a collection resource representation of all objects of a VM backup job with the specified UID. + * Path: /infrastructure/backupServers/jobs/backupVmJobs/{jobUid}/objects + */ + public function getBackupServerBackupVmJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/backupVmJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All CDP Replication Jobs Returns a collection resource representation of all CDP replication jobs. + * Path: /infrastructure/backupServers/jobs/cdpReplicationJobs + */ + public function getBackupServerCdpReplicationJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/cdpReplicationJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of CDP Replication Jobs Returns a collection resource representation of all CDP replication job objects. + * Path: /infrastructure/backupServers/jobs/cdpReplicationJobs/objects + */ + public function getBackupServerCdpReplicationJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/cdpReplicationJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get CDP Replication Job Returns a resource representation of a CDP replication job with the specified UID. + * Path: /infrastructure/backupServers/jobs/cdpReplicationJobs/{jobUid} + */ + public function getBackupServerCdpReplicationJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/cdpReplicationJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of CDP Replication Job Returns a collection resource representation of all objects of a CDP replication job with the specified UID. + * Path: /infrastructure/backupServers/jobs/cdpReplicationJobs/{jobUid}/objects + */ + public function getBackupServerCdpReplicationJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/cdpReplicationJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Copy Jobs Returns a collection resource representation of all file copy jobs. + * Path: /infrastructure/backupServers/jobs/fileCopyJobs + */ + public function getBackupServerFileCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get File Copy Job Returns a resource representation of a file copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileCopyJobs/{jobUid} + */ + public function getBackupServerFileCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Share Copy Jobs Returns a collection resource representation of all backup copy jobs for file shares. + * Path: /infrastructure/backupServers/jobs/fileShareCopyJobs + */ + public function getBackupServerFileShareCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileShareCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Copy Jobs Returns a collection resource representation of all file share backup copy job objects. + * Path: /infrastructure/backupServers/jobs/fileShareCopyJobs/objects + */ + public function getBackupServerFileShareCopyJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileShareCopyJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get File Share Copy Job Returns a resource representation of a file share backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileShareCopyJobs/{jobUid} + */ + public function getBackupServerFileShareCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileShareCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Copy Job Returns a collection resource representation of all objects of a file share backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileShareCopyJobs/{jobUid}/objects + */ + public function getBackupServerFileShareCopyJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileShareCopyJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Share Jobs Returns a collection resource representation of all file share jobs. + * Path: /infrastructure/backupServers/jobs/fileShareJobs + */ + public function getBackupServerFileShareJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileShareJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Jobs Returns a collection resource representation of all file share job objects. + * Path: /infrastructure/backupServers/jobs/fileShareJobs/objects + */ + public function getBackupServerFileShareJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileShareJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get File Share Job Returns a resource representation of a file share job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileShareJobs/{jobUid} + */ + public function getBackupServerFileShareJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileShareJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Job Returns a collection resource representation of all objects of a file share job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileShareJobs/{jobUid}/objects + */ + public function getBackupServerFileShareJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileShareJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File to Tape Jobs Returns a collection resource representation of all file to tape jobs. + * Path: /infrastructure/backupServers/jobs/fileTapeJobs + */ + public function getBackupServerFileTapeJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileTapeJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File to Tape Jobs Returns a collection resource representation of all file to tape job objects. + * Path: /infrastructure/backupServers/jobs/fileTapeJobs/objects + */ + public function getBackupServerFileTapeJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/fileTapeJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get File to Tape Job Returns a resource representation of a file to tape job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileTapeJobs/{jobUid} + */ + public function getBackupServerFileTapeJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileTapeJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File to Tape Job Returns a collection resource representation of all objects of a file to tape job with the specified UID. + * Path: /infrastructure/backupServers/jobs/fileTapeJobs/{jobUid}/objects + */ + public function getBackupServerFileTapeJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/fileTapeJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Object Storage Backup Copy Jobs Returns a collection resource representation of all backup copy jobs for object storage backups. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupCopyJobs + */ + public function getBackupServerObjectStorageBackupCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/objectStorageBackupCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Copy Jobs Returns a collection resource representation of all object storage backup backup copy job objects. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupCopyJobs/objects + */ + public function getBackupServerObjectStorageBackupCopyJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/objectStorageBackupCopyJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Object Storage Backup Copy Job Returns a resource representation of a object storage backup backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupCopyJobs/{jobUid} + */ + public function getBackupServerObjectStorageBackupCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/objectStorageBackupCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Copy Job Returns a collection resource representation of all objects of a object storage backup backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupCopyJobs/{jobUid}/objects + */ + public function getBackupServerObjectStorageBackupCopyJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/objectStorageBackupCopyJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Object Storage Backup Jobs Returns a collection resource representation of all object storage backup jobs. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupJobs + */ + public function getBackupServerObjectStorageBackupJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/objectStorageBackupJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Jobs Returns a collection resource representation of all object storage backup job objects. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupJobs/objects + */ + public function getBackupServerObjectStorageBackupJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/objectStorageBackupJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Object Storage Backup Job Returns a resource representation of a object storage backup job with the specified UID. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupJobs/{jobUid} + */ + public function getBackupServerObjectStorageBackupJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/objectStorageBackupJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Job Returns a collection resource representation of all objects of a object storage backup job with the specified UID. + * Path: /infrastructure/backupServers/jobs/objectStorageBackupJobs/{jobUid}/objects + */ + public function getBackupServerObjectStorageBackupJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/objectStorageBackupJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Replication Jobs Returns a resource representation of all replication jobs that protects VMs. + * Path: /infrastructure/backupServers/jobs/replicationVmJobs + */ + public function getBackupServerReplicationVmJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/replicationVmJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Replication Jobs Returns a collection resource representation of all VM replication job objects. + * Path: /infrastructure/backupServers/jobs/replicationVmJobs/objects + */ + public function getBackupServerReplicationVmJobsObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/replicationVmJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VM Replication Job Returns a resource representation of a replication job with the specified UID that protects VMs. + * Path: /infrastructure/backupServers/jobs/replicationVmJobs/{jobUid} + */ + public function getBackupServerReplicationVmJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/replicationVmJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Replication Job Returns a collection resource representation of all objects of a VM replication job with the specified UID. + * Path: /infrastructure/backupServers/jobs/replicationVmJobs/{jobUid}/objects + */ + public function getBackupServerReplicationVmJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/replicationVmJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Immediate Backup Copy Jobs Returns a collection resource representation of all immediate backup copy jobs. + * Path: /infrastructure/backupServers/jobs/simpleBackupCopyJobs + */ + public function getBackupServerSimpleBackupCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/simpleBackupCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Immediate Backup Copy Jobs Returns a collection resource representation of all immediate backup copy job objects. + * Path: /infrastructure/backupServers/jobs/simpleBackupCopyJobs/objects + */ + public function getBackupServerSimpleBackupCopyJobsLinkedJobObjects(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/simpleBackupCopyJobs/objects'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Immediate Backup Copy Job Returns a resource representation of an immediate backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/simpleBackupCopyJobs/{jobUid} + */ + public function getBackupServerSimpleBackupCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/simpleBackupCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Immediate Backup Copy Job Returns a collection resource representation of all objects of an immediate backup copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/simpleBackupCopyJobs/{jobUid}/objects + */ + public function getBackupServerSimpleBackupCopyJobLinkedJobObjects(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/simpleBackupCopyJobs/%s/objects', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Copy Jobs Returns a collection resource representation of all VM copy jobs. + * Path: /infrastructure/backupServers/jobs/vmCopyJobs + */ + public function getBackupServerVmCopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/jobs/vmCopyJobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VM Copy Job Returns a resource representation of a VM copy job with the specified UID. + * Path: /infrastructure/backupServers/jobs/vmCopyJobs/{jobUid} + */ + public function getBackupServerVmCopyJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/vmCopyJobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Job Returns a resource representation of a job with the specified UID. + * Path: /infrastructure/backupServers/jobs/{jobUid} + */ + public function getBackupServerJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/jobs/%s', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Job Modifies a job with the specified UID. Returns a positive response when the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid} + */ + public function patchBackupServerJob(string $jobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/jobs/%s', $jobUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Unassign Job from Company Unassigns a job with the specified UID from a company. >Returns a positive response when the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid}/assign + */ + public function unassignBackupServerJob(string $jobUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/jobs/%s/assign', $jobUid )); + } + + /** + * Assign Job to Company Assign a job with the specified UID to a company. >Returns a positive response when the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid}/assign + */ + public function assignBackupServerJob(string $jobUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/jobs/%s/assign', $jobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Retry Job Retries a job with the specified UID. Returns a positive response when the retry task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid}/retry + */ + public function retryBackupServerJob(string $jobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/jobs/%s/retry', $jobUid )); + } + + /** + * Start Job Starts a job with the specified UID. Returns a positive response when the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid}/start + */ + public function startBackupServerJob(string $jobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/jobs/%s/start', $jobUid )); + } + + /** + * Stop Job Stops a job with the specified UID. Returns a positive response when the task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/jobs/{jobUid}/stop + */ + public function stopBackupServerJob(string $jobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/jobs/%s/stop', $jobUid )); + } + + /** + * Get All Jobs Configured on Backup Server Returns a collection resource representation of all jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs + */ + public function getBackupServerJobByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Agent Jobs Configured on Backup Server Returns a collection resource representation of all backup agent jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/agentJobs + */ + public function getBackupServerAgentJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/agentJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Periodic Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of all periodic backup copy and legacy periodic backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupCopyJobs + */ + public function getBackupServerBackupCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Periodic Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of objects of all periodic backup copy and legacy periodic backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupCopyJobs/jobObjects + */ + public function getBackupServerBackupCopyJobsLinkedJobObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupCopyJobs/jobObjects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup to Tape Jobs Configured on Backup Server Returns a collection resource representation of all backup to tape jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupTapeJobs + */ + public function getBackupServerBackupTapeJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupTapeJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Job Objects of Backup to Tape Jobs Configured on Backup Server Returns a collection resource representation of all jobs that are processed by backup to tape jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupTapeJobs/jobObjects + */ + public function getBackupServerBackupTapeJobsLinkedJobObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupTapeJobs/jobObjects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Repository Objects of Backup to Tape Jobs Configured on Backup Server Returns a collection resource representation of all repositories that are processed by backup to tape jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupTapeJobs/repositoryObjects + */ + public function getBackupServerBackupTapeJobsLinkedRepositoryObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupTapeJobs/repositoryObjects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Backup Jobs Configured on Backup Server Returns a collection resource representation of all VM backup jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupVmJobs + */ + public function getBackupServerBackupVmJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupVmJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Backup Jobs Configured on Backup Server Returns a collection resource representation of all objects of VM backup jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/backupVmJobs/objects + */ + public function getBackupServerBackupVmJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/backupVmJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All CDP Replication Jobs Configured on Backup Server Returns a collection resource representation of all CDP replication jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/cdpReplicationJobs + */ + public function getBackupServerCdpReplicationJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/cdpReplicationJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of CDP Replication Jobs Configured on Backup Server Returns a collection resource representation of all objects of CDP replication jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/cdpReplicationJobs/objects + */ + public function getBackupServerCdpReplicationJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/cdpReplicationJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Copy Jobs Configured on Backup Server Returns a collection resource representation of all file copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileCopyJobs + */ + public function getBackupServerFileCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Share Copy Jobs Configured on Backup Server Returns a collection resource representation of all file share backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileShareCopyJobs + */ + public function getBackupServerFileShareCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileShareCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Copy Jobs Configured on Backup Server Returns a collection resource representation of all objects of file share backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileShareCopyJobs/objects + */ + public function getBackupServerFileShareCopyJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileShareCopyJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File Share Jobs Configured on Backup Server Returns a collection resource representation of all file share jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileShareJobs + */ + public function getBackupServerFileShareJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileShareJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File Share Jobs Configured on Backup Server Returns a collection resource representation of all objects of file share jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileShareJobs/objects + */ + public function getBackupServerFileShareJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileShareJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All File to Tape Jobs Configured on Backup Server Returns a collection resource representation of all file to tape jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileTapeJobs + */ + public function getBackupServerFileTapeJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileTapeJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of File to Tape Jobs Configured on Backup Server Returns a collection resource representation of all objects of file to tape jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/fileTapeJobs/objects + */ + public function getBackupServerFileTapeJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/fileTapeJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Object Storage Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of all object storage backup backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/objectStorageBackupCopyJobs + */ + public function getBackupServerObjectStorageBackupCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/objectStorageBackupCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of all objects of object storage backup backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/objectStorageBackupCopyJobs/objects + */ + public function getBackupServerObjectStorageBackupCopyJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/objectStorageBackupCopyJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Object Storage Backup Jobs Configured on Backup Server Returns a collection resource representation of all object storage backup jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/objectStorageBackupJobs + */ + public function getBackupServerObjectStorageBackupJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/objectStorageBackupJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Object Storage Backup Jobs Configured on Backup Server Returns a collection resource representation of all objects of object storage backup jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/objectStorageBackupJobs/objects + */ + public function getBackupServerObjectStorageBackupJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/objectStorageBackupJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Replication Jobs Configured on Backup Server Returns a collection resource representation of all VM replication jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/replicationVmJobs + */ + public function getBackupServerReplicationVmJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/replicationVmJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of VM Replication Jobs Configured on Backup Server Returns a collection resource representation of all objects of VM replication jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/replicationVmJobs/objects + */ + public function getBackupServerReplicationVmJobsObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/replicationVmJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Immediate Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of all immediate backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/simpleBackupCopyJobs + */ + public function getBackupServerSimpleBackupCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/simpleBackupCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Objects of Immediate Backup Copy Jobs Configured on Backup Server Returns a collection resource representation of all objects of immediate backup copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/simpleBackupCopyJobs/objects + */ + public function getBackupServerSimpleBackupCopyJobsLinkedJobObjectsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/simpleBackupCopyJobs/objects', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VM Copy Jobs Configured on Backup Server Returns a collection resource representation of all VM copy jobs configured on a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/jobs/vmCopyJobs + */ + public function getBackupServerVmCopyJobsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/jobs/vmCopyJobs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } +} diff --git a/src/Repositories/BackupServerRepository.php b/src/Repositories/BackupServerRepository.php index 9da8054..dc97a24 100755 --- a/src/Repositories/BackupServerRepository.php +++ b/src/Repositories/BackupServerRepository.php @@ -3,48 +3,454 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class BackupServerRepository implements Repository { use CreateGetRequest; + use CreatePostRequest; public function getBaseRoute(): string { return 'infrastructure/backupServers'; } - - public function getAll(): RequestBuilder { - return $this->createGetRequest( '' ); + + /** + * Get All Backup Servers Returns a collection resource representation of all Veeam Backup & Replication servers. + * Path: /infrastructure/backupServers + */ + public function getBackupServers(array $query = []): RequestBuilder { + $request = $this->createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Backup Agents Managed by All Veeam Backup & Replication Servers Returns a collection resource representation of all Veeam backup agents managed by connected Veeam Backup & Replication servers. + * Path: /infrastructure/backupServers/agents + */ + public function getBackupServersAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/agents'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Protection Groups Returns a collection resource representation of all protection groups configured on managed Veeam Backup & Replication servers. + * Path: /infrastructure/backupServers/protectionGroups + */ + public function getBackupServerAgentProtectionGroups(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/protectionGroups'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Proxies Returns a collection resource representation of all backup proxies. + * Path: /infrastructure/backupServers/proxies + */ + public function getBackupProxies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/proxies'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Repositories Returns a collection resource representation of all backup repositories. + * Path: /infrastructure/backupServers/repositories + */ + public function getBackupRepositories(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/repositories'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hosts Connected to Backup Servers Returns a collection resource representation of all servers connected to all Veeam Backup & Replication servers. + * Path: /infrastructure/backupServers/servers + */ + public function getBackupServerHosts(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/servers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Servers Returns a collection resource representation of all VMware Cloud Director servers. + * Path: /infrastructure/backupServers/vcdServers + */ + public function getVcdServers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Organizations Returns a collection resource representation of all VMware Cloud Director organizations. + * Path: /infrastructure/backupServers/vcdServers/vcdOrganizations + */ + public function getVcdOrganizations(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of All VMware Cloud Director Organizations Returns a collection resource representation of users of all VMware Cloud Director organizations. + * Path: /infrastructure/backupServers/vcdServers/vcdOrganizations/users + */ + public function getVcdOrganizationUsers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations/users'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organization VDCs Returns a collection resource representation of all organization VDCs. + * Path: /infrastructure/backupServers/vcdServers/vcdOrganizations/vDCs + */ + public function getVcdOrganizationVDCs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations/vDCs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All WAN Accelerators Returns a collection resource representation of all WAN accelerators. + * Path: /infrastructure/backupServers/wanaccelerators + */ + public function getBackupWanAccelerators(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/wanaccelerators'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Server Returns a resource representation of a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid} + */ + public function getBackupServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Backup Agents Managed by Veeam Backup & Replication Server Returns a collection resource representation of all Veeam backup agents managed by a connected Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/agents + */ + public function getBackupServerAgentsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/agents', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Backup Agent Managed by Veeam Backup & Replication Server Returns a resource representation of a Veeam backup agent with the specified UID managed by a Veeam Backup & Replication server. + * Path: /infrastructure/backupServers/{backupServerUid}/agents/{agentUid} + */ + public function getBackupServerAgent(string $backupServerUid, string $agentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/agents/%s', $backupServerUid, $agentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Force Data Collection from Backup Server Forces data collection from a Veeam Backup & Replication server with the specified UID. Returns a positive response when the collection task is added to the internal queue and not when the task is executed. + * Path: /infrastructure/backupServers/{backupServerUid}/collect + */ + public function forceCollectBackupServer(string $backupServerUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/collect', $backupServerUid )); + } + + /** + * Get All Protection Groups Configured on Backup Server Returns a collection resource representation of all protection groups configured on a managed Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/protectionGroups + */ + public function getBackupServerAgentProtectionGroupsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/protectionGroups', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Proxies Connected to Backup Server Returns a collection resource representation of all backup proxies connected to a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/proxies + */ + public function getBackupProxiesByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/proxies', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Proxy Returns a resource representation of a backup proxy with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/proxies/{proxyUid} + */ + public function getBackupProxy(string $backupServerUid, string $proxyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/proxies/%s', $backupServerUid, $proxyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Repositories Connected to Backup Server Returns a collection resource representation of all backup repositories connected to a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/repositories + */ + public function getBackupRepositoriesByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/repositories', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Backup Repository Returns a resource representation of a backup repository with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/repositories/{repositoryUid} + */ + public function getBackupRepository(string $backupServerUid, string $repositoryUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/repositories/%s', $backupServerUid, $repositoryUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hosts Connected to Backup Server Returns a collection resource representation of all servers connected to a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/servers + */ + public function getBackupServerHostsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/servers', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Host Connected to Backup Server Returns a resource representation of a server with the specified UID connected to a Veeam Backup & Replication server. + * Path: /infrastructure/backupServers/{backupServerUid}/servers/{serverUid} + */ + public function getBackupServerHost(string $backupServerUid, string $serverUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/servers/%s', $backupServerUid, $serverUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Servers Managed by Veeam Backup & Replication Server Returns a collection resource representation of all VMware Cloud Director servers managed by a Veeam Backup & Replication Server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers + */ + public function getVcdServersByBackupServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Organizations Managed by Veeam Backup & Replication Server Returns a collection resource representation of all VMware Cloud Director organizations managed by a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations + */ + public function getVcdOrganizationsByBackupServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of All VMware Cloud Director Organizations Managed by Veeam Backup & Replication server Returns a collection resource representation of users of all VMware Cloud Director organizations managed by a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/users + */ + public function getVcdOrganizationUsersByBackupServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/users', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organization VDCs Managed by Veeam Backup & Replication Server Returns a collection resource representation of all organization VDCs managed by a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/vDCs + */ + public function getVcdOrganizationVDCsByBackupServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/vDCs', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization VDC Returns a resource representation of an organization VDC with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/vDCs/{vdcUid} + */ + public function getVcdOrganizationVDC(string $backupServerUid, string $vdcUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/vDCs/%s', $backupServerUid, $vdcUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VMware Cloud Director Organization Returns a resource representation of a VMware Cloud Director organization with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid} + */ + public function getVcdOrganization(string $backupServerUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s', $backupServerUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of VMware Cloud Director Organization Returns a collection resource representation of all users of a VMware Cloud Director organization with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid}/users + */ + public function getVcdOrganizationUsersByOrganization(string $backupServerUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s/users', $backupServerUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VDCs Providing Resources to VMware Cloud Director Organization Returns a collection resource representation of all VDCs that provide resources to a VMware Cloud Director organization with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid}/vDCs + */ + public function getVcdOrganizationVDCsByOrganization(string $backupServerUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s/vDCs', $backupServerUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllBackupRepositories(bool $expand = true): RequestBuilder { - $request = $this->createGetRequest( '/repositories' ); - if ($expand) { - $request->query([ - 'expand' => 'BackupRepositoryInfo' - ]); - } + /** + * Get VMware Cloud Director Server Returns a resource representation of a VMware Cloud Director server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/{vcdServerUid} + */ + public function getVcdServer(string $backupServerUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s', $backupServerUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } - return $request; + /** + * Get All VMware Cloud Director Organizations Configured on VMware Cloud Director Server Returns a collection resource representation of all VMware Cloud Director organizations configured on a VMware Cloud Director server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/{vcdServerUid}/vcdOrganizations + */ + public function getVcdOrganizationsByVcd(string $backupServerUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s/vcdOrganizations', $backupServerUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - public function getBackupRepository( string $backupServerUid, string $repositoryUid, bool $expand = true ): RequestBuilder { - $request = $this->createGetRequest( sprintf( '/%s/repositories/%s', $backupServerUid, $repositoryUid ) ); + /** + * Get All Organization VDCs on VMware Cloud Director Server Returns a collection resource representation of all organization VDCs on a VMware Cloud Director Server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/{vcdServerUid}/vcdOrganizations/vDCs + */ + public function getVcdOrganizationVDCsByVcd(string $backupServerUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s/vcdOrganizations/vDCs', $backupServerUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } - if ($expand) { - $request->query([ - 'expand' => 'BackupRepositoryInfo' - ]); - } + /** + * Get vApps Configured on VMware Cloud Director Server Returns a collection resource representation of all vApps configured on a VMware Cloud Director server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/{vcdServerUid}/vcdOrganizations/vDCs/vApps + */ + public function getVcdOrganizationVAppsByVcd(string $backupServerUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s/vcdOrganizations/vDCs/vApps', $backupServerUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } - return $request; + /** + * Get VMs Configured on VMware Cloud Director Server Returns a collection resource representation of all VMs configured on a VMware Cloud Director server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/vcdServers/{vcdServerUid}/vcdOrganizations/vDCs/virtualMachines + */ + public function getVcdOrganizationVirtualMachinesByVcd(string $backupServerUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s/vcdOrganizations/vDCs/virtualMachines', $backupServerUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllJobs(): RequestBuilder { - return $this->createGetRequest( '/jobs' ); + + /** + * Get All WAN Accelerators Connected to Backup Server Returns a collection resource representation of all WAN accelerators connected to a Veeam Backup & Replication server with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/wanaccelerators + */ + public function getBackupWanAcceleratorsByServer(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/wanaccelerators', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getBackupServer( string $backupServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf('/%s', $backupServerUid ) ); + + /** + * Get WAN Accelerator Returns a resource representation of a WAN accelerator with the specified UID. + * Path: /infrastructure/backupServers/{backupServerUid}/wanaccelerators/{wanAcceleratorUid} + */ + public function getBackupWanAccelerator(string $backupServerUid, string $wanAcceleratorUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/wanaccelerators/%s', $backupServerUid, $wanAcceleratorUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/CloudConnectRepository.php b/src/Repositories/CloudConnectRepository.php index 1284e6f..c0cef05 100755 --- a/src/Repositories/CloudConnectRepository.php +++ b/src/Repositories/CloudConnectRepository.php @@ -2,21 +2,582 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePutRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class CloudConnectRepository implements Repository { use CreateGetRequest; - + use CreatePatchRequest; + use CreatePutRequest; + public function getBaseRoute(): string { return 'infrastructure/sites'; } - - public function getAllSites(): RequestBuilder { - return $this->createGetRequest( '' ); + + /** + * Get All Sites Returns a collection resource representation of all cloud agents installed on sites. + * Path: /infrastructure/sites + */ + public function getSites(array $query = []): RequestBuilder { + $request = $this->createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Site Backups Returns a collection resource representation of backups created by all Veeam Cloud Connect sites. + * Path: /infrastructure/sites/backups + */ + public function getCloudBackups(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/backups'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Site Backup Returns a resource representation of a backup with the specified UID created by a Veeam Cloud Connect site. + * Path: /infrastructure/sites/backups/{backupUid} + */ + public function getCloudBackup(string $backupUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/backups/%s', $backupUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateway Pools Returns a collection resource representation of all cloud gateway pools. + * Path: /infrastructure/sites/cloudgatewaypools + */ + public function getCloudGatewayPools(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/cloudgatewaypools'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Cloud Gateway Pool Returns a resource representation of a cloud gateway pool with the specified UID. + * Path: /infrastructure/sites/cloudgatewaypools/{instanceUid} + */ + public function getCloudGatewayPool(string $instanceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/cloudgatewaypools/%s', $instanceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateways in Pool Returns a collection resource representation of all cloud gateways included in a pool with the specified UID. + * Path: /infrastructure/sites/cloudgatewaypools/{instanceUid}/cloudgateways + */ + public function getCloudGatewaysByPool(string $instanceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/cloudgatewaypools/%s/cloudgateways', $instanceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateways Returns a collection resource representation of all cloud gateways. + * Path: /infrastructure/sites/cloudgateways + */ + public function getCloudGateways(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/cloudgateways'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Cloud Gateway Returns a resource representation of a cloud gateway with the specified UID. + * Path: /infrastructure/sites/cloudgateways/{gatewayUid} + */ + public function getCloudGateway(string $gatewayUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/cloudgateways/%s', $gatewayUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hardware Plans Returns a collection resource representation of all hardware plans. + * Path: /infrastructure/sites/hardwarePlans + */ + public function getBackupHardwarePlans(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hardwarePlans'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hardware Plan Storage Entities Returns a collection resource representation of all storage entities in all hardware plans. + * Path: /infrastructure/sites/hardwarePlans/storages + */ + public function getBackupHardwarePlansStorages(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hardwarePlans/storages'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Hardware Plan Returns a resource representation of a hardware plan with the specified UID. + * Path: /infrastructure/sites/hardwarePlans/{instanceUid} + */ + public function getBackupHardwarePlan(string $instanceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/hardwarePlans/%s', $instanceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hardware Plan Storage Entities Returns a collection resource representation of all storage entities in a hardware plan with the specified UID. + * Path: /infrastructure/sites/hardwarePlans/{instanceUid}/storages + */ + public function getBackupHardwarePlanStorages(string $instanceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/hardwarePlans/%s/storages', $instanceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllCloudGatewayPools(): RequestBuilder { - return $this->createGetRequest( '/cloudgatewaypools' ); + + /** + * Get All Tenants Returns a collection resource representation of all tenants. + * Path: /infrastructure/sites/tenants + */ + public function getTenants(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/tenants'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Tenant Veeam Products Returns a collection resource representation of tenant Veeam products that generated cloud data the latest. + * Path: /infrastructure/sites/tenants/products + */ + public function getCloudTenantsProducts(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/tenants/products'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Subtenants Returns a collection resource representation of all subtenants. + * Path: /infrastructure/sites/tenants/subtenants + */ + public function getSubTenants(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/tenants/subtenants'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Subtenant Returns a resource representation of a subtenant with the specified UID. + * Path: /infrastructure/sites/tenants/subtenants/{subtenantUid} + */ + public function getSubTenant(string $subtenantUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/tenants/subtenants/%s', $subtenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Tenant Returns a resource representation of a tenant with the specified UID. + * Path: /infrastructure/sites/tenants/{tenantUid} + */ + public function getTenant(string $tenantUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/tenants/%s', $tenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateway Pools Assigned to Tenant Returns a collection resource representation of all cloud gateway pools assigned to a tenant with the specified UID. + * Path: /infrastructure/sites/tenants/{tenantUid}/cloudGatewayPools + */ + public function getCloudGatewayPoolsByTenant(string $tenantUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/tenants/%s/cloudGatewayPools', $tenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Subtenants Registered by Tenant Returns a collection resource representation of all subtenants registered by a tenant with the specified UID. + * Path: /infrastructure/sites/tenants/{tenantUid}/subtenants + */ + public function getSubTenantsByTenant(string $tenantUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/tenants/%s/subtenants', $tenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VMware Cloud Director Servers Managed by All Veeam Cloud Connect Sites Returns a collection resource representation of VMware Cloud Director servers managed by all Veeam Cloud Connect Sites. + * Path: /infrastructure/sites/vcdServers + */ + public function getSitesVcdServers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VMware Cloud Director Organizations Managed by All Veeam Cloud Connect Sites Returns a collection resource representation of VMware Cloud Director organizations managed by all Veeam Cloud Connect sites. + * Path: /infrastructure/sites/vcdServers/vcdOrganizations + */ + public function getSitesVcdOrganizations(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of VMware Cloud Director Organizations Managed by All Veeam Cloud Connect Sites Returns a collection resource representation of users of VMware Cloud Director organizations managed by all Veeam Cloud Connect sites. + * Path: /infrastructure/sites/vcdServers/vcdOrganizations/users + */ + public function getSitesVcdOrganizationUsers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations/users'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization VDCs Managed by All Veeam Cloud Connect Sites Returns a collection resource representation of organization VDCs managed by all Veeam Cloud Connect Sites. + * Path: /infrastructure/sites/vcdServers/vcdOrganizations/vDCs + */ + public function getSitesVcdOrganizationVDCs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vcdServers/vcdOrganizations/vDCs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Wan Accelerators Returns a collection resource representation of all WAN accelerators. + * Path: /infrastructure/sites/wanAccelerators + */ + public function getSiteWanAcceleratorResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/wanAccelerators'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Wan Accelerator Returns a resource representation of a WAN accelerator with the specified UID. + * Path: /infrastructure/sites/wanAccelerators/{wanAcceleratorUid} + */ + public function getSiteWanAcceleratorResource(string $wanAcceleratorUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/wanAccelerators/%s', $wanAcceleratorUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Site Returns a resource representation of a cloud agent installed on a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid} + */ + public function getSite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Site Modifies a cloud agent installed on a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid} + */ + public function patchSite(string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s', $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backups Created by Site Returns a collection resource representation of all backups created by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/backups + */ + public function getCloudBackupsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/backups', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateway Pools Configured for Site Returns a collection resource representation of all cloud gateway pools configured for a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/cloudgatewaypools + */ + public function getCloudGatewayPoolsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/cloudgatewaypools', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Cloud Gateways Configured for Site Returns a collection resource representation of all cloud gateways configured for a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/cloudgateways + */ + public function getCloudGatewaysBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/cloudgateways', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hardware Plans Configured on Site Returns a collection resource representation of all hardware plans configured on a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/hardwarePlans + */ + public function getBackupHardwarePlansBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hardwarePlans', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Set Site Maintenance Mode Enables or disables the maintenance mode for a site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/maintenanceModeIsEnabled + */ + public function setSiteMaintenanceMode(string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/%s/maintenanceModeIsEnabled', $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Set Tenant Management on Site Enables or disables tenant management on a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/tenantManagementInCloudConnectIsEnabled + */ + public function setSiteTenantManagementMode(string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/%s/tenantManagementInCloudConnectIsEnabled', $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Tenants Registered on Site Returns a collection resource representation of tenants registered on a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/tenants + */ + public function getTenantsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/tenants', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Tenant Veeam Products on Site Returns a collection resource representation of tenant Veeam products that generated the latest cloud data managed by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/tenants/products + */ + public function getCloudTenantsProductsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/tenants/products', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Subtenants Registered on Site Returns a collection resource representation of all subtenants provided with resources of a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/tenants/subtenants + */ + public function getSubTenantsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/tenants/subtenants', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Servers Managed by Veeam Cloud Connect Site Returns a collection resource representation of all VMware Cloud Director servers managed by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/vcdServers + */ + public function getVcdServersBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Organizations Managed by Veeam Cloud Connect Site Returns a collection resource representation of all VMware Cloud Director organizations managed by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations + */ + public function getVcdOrganizationsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of All VMware Cloud Director Organizations Managed by Veeam Cloud Connect Site Returns a collection resource representation of users of all VMware Cloud Director organizations managed by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/users + */ + public function getVcdOrganizationUsersBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/users', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organization VDCs Managed by Veeam Cloud Connect Site Returns a collection resource representation of all organization VDCs managed by a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/vDCs + */ + public function getVcdOrganizationVDCsBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/vDCs', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization VDC Managed by Veeam Cloud Connect Site Returns a resource representation of an organization VDC with the specified UID managed by a Veeam Cloud Connect site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/vDCs/{vdcUid} + */ + public function getSiteVcdOrganizationVDC(string $siteUid, string $vdcUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/vDCs/%s', $siteUid, $vdcUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VMware Cloud Director Organization Managed by Veeam Cloud Connect Site Returns a resource representation of a VMware Cloud Director organization with the specified UID managed by Veeam Cloud Connect Site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid} + */ + public function getSiteVcdOrganization(string $siteUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s', $siteUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Users of VMware Cloud Director Organization Managed by Veeam Cloud Connect Site Returns a collection resource representation of all users of a VMware Cloud Director organization with the specified UID managed by a Veeam Cloud Connect site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid}/users + */ + public function getSiteVcdOrganizationUsersByOrganization(string $siteUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s/users', $siteUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VDCs Providing Resources to VMware Cloud Director Organization Managed by Veeam Cloud Connect Site Returns a collection resource representation of all VDCs that provide resources to a VMware Cloud Director organization with the specified UID managed by a Veeam Cloud Connect Site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/vcdOrganizations/{vcdOrganizationUid}/vDCs + */ + public function getSitesVcdOrganizationVDCsByOrganization(string $siteUid, string $vcdOrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/vcdOrganizations/%s/vDCs', $siteUid, $vcdOrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get VMware Cloud Director Server Managed by Veeam Cloud Connect Site Returns a resource representation of a VMware Cloud Director server with the specified UID managed by a Veeam Cloud Connect site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/{vcdServerUid} + */ + public function getSiteVcdServer(string $siteUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s', $siteUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organizations Configured on VMware Cloud Director Server Managed by Veeam Cloud Connect Site Returns a collection resource representation of all VMware Cloud Director organizations configured on a VMware Cloud Director server with the specified UID managed by a Veeam Cloud Connect site. + * Path: /infrastructure/sites/{siteUid}/vcdServers/{vcdServerUid}/vcdOrganizations + */ + public function getSitesVcdOrganizationsByVcd(string $siteUid, string $vcdServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/vcdServers/%s/vcdOrganizations', $siteUid, $vcdServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Wan Accelerators Configured for Site Returns a collection resource representation of all WAN accelerators configured for a Veeam Cloud Connect site with the specified UID. + * Path: /infrastructure/sites/{siteUid}/wanAccelerators + */ + public function getSiteWanAcceleratorResourcesBySite(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/wanAccelerators', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/CompanyRepository.php b/src/Repositories/CompanyRepository.php index d5da12d..a034cbd 100755 --- a/src/Repositories/CompanyRepository.php +++ b/src/Repositories/CompanyRepository.php @@ -2,14 +2,7 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; -use Shellrent\VeeamVspcApiClient\Payloads\CreateCompanyBackupResourcePayload; -use Shellrent\VeeamVspcApiClient\Payloads\CreateCompanyMicrosoft365BackupResourcePayload; -use Shellrent\VeeamVspcApiClient\Payloads\CreateCompanyMicrosoft365ResourcePayload; -use Shellrent\VeeamVspcApiClient\Payloads\CreateCompanyPayload; -use Shellrent\VeeamVspcApiClient\Payloads\CreateCompanySiteResourcePayload; -use Shellrent\VeeamVspcApiClient\Payloads\EditCompanyBackupResourcePayload; -use Shellrent\VeeamVspcApiClient\Payloads\ModifyCompanyPayload; -use Shellrent\VeeamVspcApiClient\Payloads\ModifyCompanyResourcePayload; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; @@ -17,106 +10,956 @@ use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class CompanyRepository implements Repository { - use CreatePostRequest; - + use CreateDeleteRequest; use CreateGetRequest; - use CreatePatchRequest; - - use CreateDeleteRequest; - + use CreatePostRequest; + public function getBaseRoute(): string { return 'organizations/companies'; } - - public function getAll(bool $expand = true): RequestBuilder { - $request = $this->createGetRequest( '/' ); - if ($expand) { - $request->query([ - 'expand' => 'Organization' - ]); - } + /** + * Get All Companies Returns a collection resource representation of all companies managed in Veeam Service Provider Console. + * Path: /organizations/companies + */ + public function getCompanies(array $query = []): RequestBuilder { + $request = $this->createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company Creates a new company managed in Veeam Service Provider Console. > After you create a company, you must create a company Veeam Cloud Connect site resource by performing the `CreateCompanySiteResource` operation. + * Path: /organizations/companies + */ + public function createCompany(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Company Veeam Backup for Microsoft 356 Resources Returns a collection resource representation of Veeam Backup for Microsoft 365 resources allocated to all companies. + * Path: /organizations/companies/hostedResources/vb365 + */ + public function getCompaniesVb365Resources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vb365'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Company Veeam Backup for Microsoft 365 Backup Resources Returns a collection resource representation of all company Veeam Backup for Microsoft 365 backup resources. + * Path: /organizations/companies/hostedResources/vb365/backupResources + */ + public function getCompaniesVb365BackupResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vb365/backupResources'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Company Hosted Server Resources Returns a collection resource representation of hosted Veeam Backup & Replication server resources allocated to all companies. + * Path: /organizations/companies/hostedResources/vbr + */ + public function getCompaniesHostedVbrResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vbr'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Company Hosted Repository Resources Returns a collection resource representation of hosted Veeam Backup & Replication repository resources allocated to all companies. + * Path: /organizations/companies/hostedResources/vbr/backupResources + */ + public function getCompaniesHostedVbrBackupResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vbr/backupResources'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Mappings of VMware Cloud Director Organizations to All Companies with Assigned Hosted Resources Returns a collection resource representation of mappings of VMware Cloud Director organizations to all companies with assigned hosted resources. + * Path: /organizations/companies/hostedResources/vbr/mappedVcdOrganizations + */ + public function getCompaniesHostedVbrVcdOrganizationMappings(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vbr/mappedVcdOrganizations'); + if ($query !== []) { + $request->query($query); + } + return $request; + } - return $request; + /** + * Get All Company Tag Resources Returns a collection resource representation of all company tag resources. + * Path: /organizations/companies/hostedResources/vbr/tagResources + */ + public function getCompaniesHostedVbrTagResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/hostedResources/vbr/tagResources'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllSites( string $companyUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/sites', $companyUid ) ); + + /** + * Get All Company Site Resources Returns a resource representation of all site resources allocated to all companies. + * Path: /organizations/companies/sites + */ + public function getCompaniesSiteResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllCompanyBackupResources( string $companyUid, string $siteUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/sites/%s/backupResources', $companyUid, $siteUid ) ); + + /** + * Get All Company Backup Resources Returns a collection resource representation of all company cloud backup resources. + * Path: /organizations/companies/sites/backupResources + */ + public function getCompaniesSiteBackupResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/backupResources'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getBackupResourceUsage( string $companyUid, string $siteUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/sites/%s/backupResources/usage', $companyUid, $siteUid ) ); + + /** + * Get Usage of All Company Backup Resources Returns a collection resource representation of cloud backup resource usage by all companies. + * Path: /organizations/companies/sites/backupResources/usage + */ + public function getCompaniesSiteBackupResourcesUsages(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/backupResources/usage'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function postCreate( CreateCompanyPayload $request ): RequestBuilder { - return $this->createPostRequest( '', $request ); + + /** + * Get All Company Replication Resources Returns a collection resource representation of all company cloud replication resources. + * Path: /organizations/companies/sites/replicationResources + */ + public function getCompaniesSiteReplicationResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/replicationResources'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function patchModifyCompany( string $companyUid, ModifyCompanyPayload $payload ): RequestBuilder { - return $this->createPatchRequest( sprintf( '/%s', $companyUid ), $payload ); + + /** + * Get Usage of All Company Replication Resources Returns a collection resource representation of usage of all company cloud replication resources. + * Path: /organizations/companies/sites/replicationResources/usage + */ + public function getCompaniesSiteReplicationResourcesUsages(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/replicationResources/usage'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function postCreateCompanySiteResource( string $companyUid, CreateCompanySiteResourcePayload $request ): RequestBuilder { - return $this->createPostRequest( sprintf( '/%s/sites', $companyUid ), $request ); + + /** + * Get All Company VMware Cloud Director Replication Resources Returns a collection resource representation of all company VMware Cloud Director replication resources. + * Path: /organizations/companies/sites/vcdReplicationResources + */ + public function getCompaniesSiteVcdReplicationResources(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/vcdReplicationResources'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function postCreateCompanyBackupResource( string $companyUid, string $siteUid, CreateCompanyBackupResourcePayload $request ): RequestBuilder { - return $this->createPostRequest( sprintf( '/%s/sites/%s/backupResources', $companyUid, $siteUid ), $request ); + + /** + * Get Usage of All Company VMware Cloud Director Replication Resources Returns a collection resource representation of VMware Cloud Director replication resource usage by all companies. + * Path: /organizations/companies/sites/vcdReplicationResources/usage + */ + public function getCompaniesSiteVcdReplicationResourcesUsages(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites/vcdReplicationResources/usage'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function patchEditCompanyBackupResource( string $companyUid, string $siteUid, string $resourceUid, EditCompanyBackupResourcePayload $payload ): RequestBuilder { - return $this->createPatchRequest( sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid ), $payload ); + + /** + * Get Services Usage by All Companies Returns a collection resource representation of services consumed by companies. + * Path: /organizations/companies/usage + */ + public function getCompaniesAggregatedUsage(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/usage'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function delete( string $companyUid ): RequestBuilder { - return $this->createDeleteRequest( '/' . $companyUid ); + + /** + * Delete Company Deletes a company with the specified UID. + * Path: /organizations/companies/{companyUid} + */ + public function deleteCompany(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf( '/%s', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function get( string $companyUid ): RequestBuilder { - return $this->createGetRequest( '/' . $companyUid ); + + /** + * Get Company Returns a resource representation of a company with the specified UID. + * Path: /organizations/companies/{companyUid} + */ + public function getCompany(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function deleteCompanyBackupResource( string $companyUid, string $siteUid, string $resourceUid ): RequestBuilder { - return $this->createDeleteRequest( sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid ) ); + + /** + * Modify Company Modifies a company managed in Veeam Service Provider Console. + * Path: /organizations/companies/{companyUid} + */ + public function patchCompany(string $companyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s', $companyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllCompanyVb365Resources( string $companyId ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/hostedResources/vb365', $companyId ) ); + + /** + * Get All Veeam Backup for Microsoft 365 Resources of Company Returns a collection resource representation of Veeam Backup for Microsoft 365 resources allocated to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365 + */ + public function getCompanyVb365Resources(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vb365', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllCompanyVb365BackupResources( string $companyId, string $vb365ResourceUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/hostedResources/vb365/%s/backupResources', $companyId, $vb365ResourceUid ) ); + + /** + * Create Company Veeam Backup for Microsoft 365 Resource Allocates a Veeam Backup for Microsoft 365 resource to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365 + */ + public function createCompanyVb365Resource(string $companyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vb365', $companyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getCompanyVb365BackupResource( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ) ); + + /** + * Delete Company Veeam Backup for Microsoft 365 Resource Deletes a company Veeam Backup for Microsoft 365 resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid} + */ + public function deleteCompanyVb365Resource(string $companyUid, string $vb365ResourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vb365/%s', $companyUid, $vb365ResourceUid )); } - - public function patchModifyCompanyVb365Resource( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid, ModifyCompanyResourcePayload $request ): RequestBuilder { - return $this->createPatchRequest( - sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ), - $request - ); + + /** + * Get Company Veeam Backup for Microsoft 365 Resource Returns a resource representation of company Veeam Backup for Microsoft 365 resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid} + */ + public function getCompanyVb365Resource(string $companyUid, string $vb365ResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vb365/%s', $companyUid, $vb365ResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function deleteCompanyVb365Resource( string $companyId, string $vb365ResourceUid ): RequestBuilder { - return $this->createDeleteRequest( sprintf( '/%s/hostedResources/vb365/%s', $companyId, $vb365ResourceUid ) ); + + /** + * Modify Company Veeam Backup for Microsoft 365 Resource Modifies a company Veeam Backup for Microsoft 365 resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid} + */ + public function patchCompanyVb365Resource(string $companyUid, string $vb365ResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/hostedResources/vb365/%s', $companyUid, $vb365ResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function deleteCompanyVb365BackupResources( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid ): RequestBuilder { - return $this->createDeleteRequest( sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ) ); + + /** + * Get All Veeam Backup for Microsoft 365 Backup Resources of Company Returns a collection resource representation of all backup resources allocated to a company on a Veeam Backup for Microsoft 365 resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid}/backupResources + */ + public function getCompanyVb365BackupResources(string $companyUid, string $vb365ResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vb365/%s/backupResources', $companyUid, $vb365ResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function createCompanyVb365Resource( string $companyId, CreateCompanyMicrosoft365ResourcePayload $request ): RequestBuilder { - return $this->createPostRequest( sprintf( '/%s/hostedResources/vb365', $companyId ), $request ); + + /** + * Create Company Veeam Backup for Microsoft 365 Backup Resource Allocates a new backup resource to a company on a Veeam Backup for Microsoft 365 resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid}/backupResources + */ + public function createCompanyVb365BackupResource(string $companyUid, string $vb365ResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vb365/%s/backupResources', $companyUid, $vb365ResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function createCompanyVb365BackupResource( string $companyId, string $vb365ResourceUid, CreateCompanyMicrosoft365BackupResourcePayload $request ): RequestBuilder { - return $this->createPostRequest( sprintf( '/%s/hostedResources/vb365/%s/backupResources', $companyId, $vb365ResourceUid ), $request ); + + /** + * Delete Company Veeam Backup for Microsoft 365 Backup Resource Deletes a company Veeam Backup for Microsoft 365 backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid}/backupResources/{vb365BackupResourceUid} + */ + public function deleteCompanyVb365BackupResource(string $companyUid, string $vb365ResourceUid, string $vb365BackupResourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyUid, $vb365ResourceUid, $vb365BackupResourceUid )); + } + + /** + * Get Company Veeam Backup for Microsoft 365 Backup Resource Returns a resource representation of a company Veeam Backup for Microsoft 365 backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid}/backupResources/{vb365BackupResourceUid} + */ + public function getCompanyVb365BackupResource(string $companyUid, string $vb365ResourceUid, string $vb365BackupResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyUid, $vb365ResourceUid, $vb365BackupResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Veeam Backup for Microsoft 365 Backup Resource Modifies a company Veeam Backup for Microsoft 365 backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vb365/{vb365ResourceUid}/backupResources/{vb365BackupResourceUid} + */ + public function patchCompanyVb365BackupResource(string $companyUid, string $vb365ResourceUid, string $vb365BackupResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/hostedResources/vb365/%s/backupResources/%s', $companyUid, $vb365ResourceUid, $vb365BackupResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hosted Server Resources of Company Returns a collection resource representation of hosted Veeam Backup & Replication server resources allocated to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr + */ + public function getCompanyHostedVbrResources(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company Hosted Server Resource Allocates a hosted Veeam Backup & Replication server resource to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr + */ + public function createCompanyHostedVbrResource(string $companyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vbr', $companyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Company Hosted Server Resource Deletes a company hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid} + */ + public function deleteCompanyHostedVbrResource(string $companyUid, string $vbrHostedResourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vbr/%s', $companyUid, $vbrHostedResourceUid )); + } + + /** + * Get Company Hosted Server Resource Returns a resource representation of a company hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid} + */ + public function getCompanyHostedVbrResource(string $companyUid, string $vbrHostedResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s', $companyUid, $vbrHostedResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Hosted Server Resource Modifies a company hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid} + */ + public function patchCompanyHostedVbrResource(string $companyUid, string $vbrHostedResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/hostedResources/vbr/%s', $companyUid, $vbrHostedResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Hosted Repository Resources of Company Returns a collection resource representation of all Veeam Backup & Replication repository resources allocated to a company on a hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/backupResources + */ + public function getCompanyHostedVbrBackupResources(string $companyUid, string $vbrHostedResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/backupResources', $companyUid, $vbrHostedResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company Hosted Repository Resource Allocates a new Veeam Backup & Replication repository resource to a company on a hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/backupResources + */ + public function createCompanyHostedVbrBackupResource(string $companyUid, string $vbrHostedResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vbr/%s/backupResources', $companyUid, $vbrHostedResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Company Hosted Repository Resource Deletes a company hosted Veeam Backup & Replication repository resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/backupResources/{hostedVbrBackupResourceUid} + */ + public function deleteCompanyHostedVbrBackupResource(string $companyUid, string $vbrHostedResourceUid, string $hostedVbrBackupResourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vbr/%s/backupResources/%s', $companyUid, $vbrHostedResourceUid, $hostedVbrBackupResourceUid )); + } + + /** + * Get Company Hosted Repository Resource Returns a resource representation of a company hosted Veeam Backup & Replication repository resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/backupResources/{hostedVbrBackupResourceUid} + */ + public function getCompanyHostedVbrBackupResource(string $companyUid, string $vbrHostedResourceUid, string $hostedVbrBackupResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/backupResources/%s', $companyUid, $vbrHostedResourceUid, $hostedVbrBackupResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Hosted Repository Resource Modifies a company hosted Veeam Backup & Replication repository resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/backupResources/{hostedVbrBackupResourceUid} + */ + public function patchCompanyHostedVbrBackupResource(string $companyUid, string $vbrHostedResourceUid, string $hostedVbrBackupResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/hostedResources/vbr/%s/backupResources/%s', $companyUid, $vbrHostedResourceUid, $hostedVbrBackupResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Mappings of VMware Cloud Director Organizations to Company with Assigned Hosted Resource Returns a collection resource representation of all mappings of VMware Cloud Director organizations to a company with an assigned hosted resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/mappedVcdOrganizations + */ + public function getCompanyHostedVbrVcdOrganizationMappings(string $companyUid, string $vbrHostedResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/mappedVcdOrganizations', $companyUid, $vbrHostedResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Mapping of VMware Cloud Director Organization to Company with Assigned Hosted Resource Maps a VMware Cloud Director organization to a company with an assigned hosted resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/mappedVcdOrganizations + */ + public function createCompanyHostedVbrVcdOrganizationMapping(string $companyUid, string $vbrHostedResourceUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vbr/%s/mappedVcdOrganizations', $companyUid, $vbrHostedResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete VMware Cloud Director Organization to Company Mapping Deletes a VMware Cloud Director organization to company mapping with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/mappedVcdOrganizations/{mappingUid} + */ + public function deleteCompanyHostedVbrVcdOrganizationMapping(string $companyUid, string $vbrHostedResourceUid, string $mappingUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vbr/%s/mappedVcdOrganizations/%s', $companyUid, $vbrHostedResourceUid, $mappingUid )); + } + + /** + * Get VMware Cloud Director Organization to Company Mapping Returns a resource representation of a VMware Cloud Director organization to company mapping with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/mappedVcdOrganizations/{mappingUid} + */ + public function getCompanyHostedVbrVcdOrganizationMapping(string $companyUid, string $vbrHostedResourceUid, string $mappingUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/mappedVcdOrganizations/%s', $companyUid, $vbrHostedResourceUid, $mappingUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Tag Resources on Company Hosted Server Resource Returns a collection resource representation of all tag resources allocated to a company on a hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/tagResources + */ + public function getCompanyHostedVbrTagResources(string $companyUid, string $vbrHostedResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/tagResources', $companyUid, $vbrHostedResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Tag Resource on Company Hosted Server Resource Allocates a new tag resource to a company on a hosted Veeam Backup & Replication server resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/tagResources + */ + public function createCompanyHostedVbrTagResource(string $companyUid, string $vbrHostedResourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/hostedResources/vbr/%s/tagResources', $companyUid, $vbrHostedResourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Company Tag Resource Deletes a company tag resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/tagResources/{hostedTagResourceUid} + */ + public function deleteCompanyHostedVbrTagResource(string $companyUid, string $vbrHostedResourceUid, string $hostedTagResourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/hostedResources/vbr/%s/tagResources/%s', $companyUid, $vbrHostedResourceUid, $hostedTagResourceUid )); + } + + /** + * Get Company Tag Resource Returns a resource representation of a company tag resource with the specified UID. + * Path: /organizations/companies/{companyUid}/hostedResources/vbr/{vbrHostedResourceUid}/tagResources/{hostedTagResourceUid} + */ + public function getCompanyHostedVbrTagResource(string $companyUid, string $vbrHostedResourceUid, string $hostedTagResourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/hostedResources/vbr/%s/tagResources/%s', $companyUid, $vbrHostedResourceUid, $hostedTagResourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Company Permissions Returns a collection resource representation of the Veeam Service Provider Console components that a company with the specified UID can access. + * Path: /organizations/companies/{companyUid}/permissions + */ + public function getCompanyPermissions(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/permissions', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Permissions Modifies a set of the Veeam Service Provider Console components that a company with the specified UID can access. + * Path: /organizations/companies/{companyUid}/permissions + */ + public function patchCompanyPermissions(string $companyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/permissions', $companyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Site Resources Allocated to Company Returns a resource representation of site resources allocated to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/sites + */ + public function getCompanySiteResources(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company Site Resource Allocates a new site resource to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/sites + */ + public function createCompanySiteResource(string $companyUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/sites', $companyUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Company Site Resource Deletes a company site resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid} + */ + public function deleteCompanySiteResource(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf( '/%s/sites/%s', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Company Site Resource Returns a resource representation of company site resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid} + */ + public function getCompanySiteResource(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Site Resource Modifies a company site resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid} + */ + public function patchCompanySiteResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Resources Allocated to Company on Site Returns a collection resource representation of all cloud backup resources allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources + */ + public function getCompanySiteBackupResources(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/backupResources', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Creates Company Backup Resource on Site Allocate a new cloud backup resource to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources + */ + public function createCompanySiteBackupResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/sites/%s/backupResources', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Usage of All Backup Resources Allocated to Company on Site Returns a resource representation of a cloud backup resource usage by a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources/usage + */ + public function getCompanySiteBackupResourcesUsage(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/backupResources/usage', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Company Backup Resource Deletes a company cloud backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources/{resourceUid} + */ + public function deleteCompanySiteBackupResource(string $companyUid, string $siteUid, string $resourceUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid )); + } + + /** + * Get Company Backup Resource Returns a resource representation of company cloud backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources/{resourceUid} + */ + public function getCompanySiteBackupResource(string $companyUid, string $siteUid, string $resourceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Backup Resource Modifies a company cloud backup resource with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/backupResources/{resourceUid} + */ + public function patchCompanySiteBackupResource(string $companyUid, string $siteUid, string $resourceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Replication Resources Allocated to Company on Site Returns a collection resource representation of a cloud replication resources allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources + */ + public function getCompanySiteReplicationResources(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/replicationResources', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Replication Resource on Site Modifies a cloud replication resource allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources + */ + public function patchCompanySiteReplicationResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/replicationResources', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company Replication Resource on Site Allocates a new cloud replication resource to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources + */ + public function createCompanySiteReplicationResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/sites/%s/replicationResources', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Unsubscribe Company from Hardware Plan Unsubscribes a company from a hardware plan with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/hardwarePlans/{hardwarePlanUid} + */ + public function deleteCompanySiteReplicationResourceHardwarePlan(string $companyUid, string $siteUid, string $hardwarePlanUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/sites/%s/replicationResources/hardwarePlans/%s', $companyUid, $siteUid, $hardwarePlanUid )); + } + + /** + * Get Company Hardware Plan Returns a resource representation of a company hardware plan with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/hardwarePlans/{hardwarePlanUid} + */ + public function getCompanySiteReplicationResourceHardwarePlan(string $companyUid, string $siteUid, string $hardwarePlanUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/replicationResources/hardwarePlans/%s', $companyUid, $siteUid, $hardwarePlanUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Network Extension Appliances Allocated to Company on Site Returns a collection resource representation of a network extension appliances configured for a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/networkextensionAppliance + */ + public function getCompanySiteReplicationResourcesNetworkAppliances(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/replicationResources/networkextensionAppliance', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Company Network Extension Appliance Returns a resource representation of a company network extension appliance with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/networkextensionAppliance/{applianceUid} + */ + public function getCompanySiteReplicationResourcesNetworkAppliance(string $companyUid, string $siteUid, string $applianceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/replicationResources/networkextensionAppliance/%s', $companyUid, $siteUid, $applianceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Network Extension Appliance Modifies a company network extension appliance with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/networkextensionAppliance/{applianceUid} + */ + public function patchCompanySiteReplicationResourcesNetworkAppliance(string $companyUid, string $siteUid, string $applianceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/replicationResources/networkextensionAppliance/%s', $companyUid, $siteUid, $applianceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Usage of All Replication Resources Allocated to Company on Site Returns a collection resource representation of usage of all cloud replication resources allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/replicationResources/usage + */ + public function getCompanySiteReplicationResourcesUsage(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/replicationResources/usage', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Company Traffic Resource Returns a resource representation of a cloud traffic quota configured for a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/traffic + */ + public function getCompanySiteTrafficResource(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/traffic', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Traffic Resource Modifies cloud traffic quota configured for a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/traffic + */ + public function patchCompanySiteTrafficResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/traffic', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Replication Resources Allocated to Company on Site Returns a collection resource representation of a VMware Cloud Director replication resource allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources + */ + public function getCompanySiteVcdReplicationResources(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/vcdReplicationResources', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company VMware Cloud Director Replication Resource Modifies a VMware Cloud Director replication resource allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources + */ + public function patchCompanySiteVcdReplicationResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/vcdReplicationResources', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Company VMware Cloud Director Replication Resource on Site Allocates a new VMware Cloud Director replication resource to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources + */ + public function createCompanySiteVcdReplicationResource(string $companyUid, string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/sites/%s/vcdReplicationResources', $companyUid, $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Unassign Organization VDC from Company Unassignes from a company an organization VDC with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/dataCenters/{dataCenterUid} + */ + public function deleteCompanySiteVcdReplicationResourceDataCenter(string $companyUid, string $siteUid, string $dataCenterUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/dataCenters/%s', $companyUid, $siteUid, $dataCenterUid )); + } + + /** + * Get Company Organization VDC Returns a resource representation of an organization VDC with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/dataCenters/{dataCenterUid} + */ + public function getCompanySiteVcdReplicationResourceDataCenter(string $companyUid, string $siteUid, string $dataCenterUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/dataCenters/%s', $companyUid, $siteUid, $dataCenterUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All VMware Cloud Director Replication Resources Allocated to Company on Site Returns a collection resource representation of all network extension appliances configured for a company on a Veeam Cloud Connect site with the specified system ID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/networkExtensionAppliance + */ + public function getCompanySiteVcdReplicationResourcesNetworkAppliances(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/networkExtensionAppliance', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Company Network Extension Appliance Returns a resource representation of a company network extension appliance with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/networkExtensionAppliance/{applianceUid} + */ + public function getCompanySiteVcdReplicationResourcesNetworkAppliance(string $companyUid, string $siteUid, string $applianceUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/networkExtensionAppliance/%s', $companyUid, $siteUid, $applianceUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Company Network Extension Appliance Modifies a company network extension appliance with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/networkExtensionAppliance/{applianceUid} + */ + public function patchCompanySiteVcdReplicationResourcesNetworkAppliance(string $companyUid, string $siteUid, string $applianceUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/networkExtensionAppliance/%s', $companyUid, $siteUid, $applianceUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Usage of All VMware Cloud Director Replication Resources Allocated to Company on Site Returns a collection resource representation of usage of all VMware Cloud Director replication resources allocated to a company on a Veeam Cloud Connect site with the specified UID. + * Path: /organizations/companies/{companyUid}/sites/{siteUid}/vcdReplicationResources/usage + */ + public function getCompanySiteVcdReplicationResourcesUsage(string $companyUid, string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/sites/%s/vcdReplicationResources/usage', $companyUid, $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Services Usage by Company Returns a collection resource representation of services consumed by a company with the specified UID. + * Path: /organizations/companies/{companyUid}/usage + */ + public function getCompanyAggregatedUsage(string $companyUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/usage', $companyUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Send Welcome Email to Company Sends a welcome email to a company with the specified UID. + * Path: /organizations/companies/{companyUid}/welcomeEmail + */ + public function sendWelcomeEmailToCompany(string $companyUid, ?Payload $payload = null): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/welcomeEmail', $companyUid ), $payload); } } diff --git a/src/Repositories/LicensingRepository.php b/src/Repositories/LicensingRepository.php index 9ab7190..1384ea4 100755 --- a/src/Repositories/LicensingRepository.php +++ b/src/Repositories/LicensingRepository.php @@ -2,134 +2,422 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; +use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePutRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class LicensingRepository implements Repository { + use CreateDeleteRequest; use CreateGetRequest; - + use CreatePatchRequest; + use CreatePostRequest; + use CreatePutRequest; + public function getBaseRoute(): string { return 'licensing'; } - - - public function getConsoleUsages(): RequestBuilder { - return $this->createGetRequest( '/console/usage' ); + + /** + * Get All Veeam Backup & Replication Licenses Returns a collection resource representation of the licenses installed on all managed Veeam Backup & Replication servers. + * Path: /licensing/backupServers + */ + public function getBackupServersLicenses(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/backupServers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Veeam Backup & Replication License Deletes a license from a managed Veeam Backup & Replication server with the specified UID. + * Path: /licensing/backupServers/{backupServerUid} + */ + public function deleteBackupServerLicense(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf( '/backupServers/%s', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Backup & Replication License Returns a resource representation of a license installed on a managed Veeam Backup & Replication server with the specified UID. + * Path: /licensing/backupServers/{backupServerUid} + */ + public function getBackupServerLicense(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/backupServers/%s', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Veeam Backup & Replication License Modifies a license on a managed Veeam Backup & Replication server with the specified UID. + * Path: /licensing/backupServers/{backupServerUid} + */ + public function patchBackupServerLicense(string $backupServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/backupServers/%s', $backupServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Install Veeam Backup & Replication License Install a license on a managed Veeam Backup & Replication server with the specified UID. + * Path: /licensing/backupServers/{backupServerUid} + */ + public function installBackupServerLicense(string $backupServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/backupServers/%s', $backupServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Update Veeam Backup & Replication License Downloads a new license from the Internet and installs it on a Veeam Backup & Replication server. + * Path: /licensing/backupServers/{backupServerUid}/update + */ + public function updateBackupServerLicense(string $backupServerUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/backupServers/%s/update', $backupServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Service Provider Console License Returns resource representation of the currently installed Veeam Service Provider Console license. + * Path: /licensing/console + */ + public function getConsoleLicenseInformation(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/console'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Install Veeam Service Provider Console License Installs Veeam Service Provider Console license. + * Path: /licensing/console + */ + public function installConsoleLicense(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest('/console', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Service Provider Console License Settings Returns a resource representation of the currently installed Veeam Service Provider Console license settings. + * Path: /licensing/console/settings + */ + public function getConsoleLicenseSettings(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/console/settings'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Update Veeam Service Provider Console License Downloads a new Veeam Service Provider Console license from the Internet and installs it. + * Path: /licensing/console/update + */ + public function updateConsoleLicense(array $query = []): RequestBuilder { + $request = $this->createPostRequest('/console/update'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All License Usage Reports Returns a collection resource representation of the Veeam license usage reports. + * Path: /licensing/reports + */ + public function getLicensingReports(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/reports'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Finalize License Usage Reports Finalize the Veeam license usage reports. + * Path: /licensing/reports/finalization + */ + public function finalizeLicensingReports(array $query = []): RequestBuilder { + $request = $this->createPostRequest('/reports/finalization'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Latest License Usage Reports Returns a collection resource representation of the latest Veeam license usage reports. + * Path: /licensing/reports/latest + */ + public function getLatestLicensingReports(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/reports/latest'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get License Usage Report Settings Returns a resource representation of license usage report settings. + * Path: /licensing/reports/settings + */ + public function getLicensingReportsSettings(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/reports/settings'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @param string $companyUid - * - * @return RequestBuilder - * @deprecated + * Modify License Usage Report Settings Modifies the Veeam licenses usage reports settings. + * Path: /licensing/reports/settings */ - public function getConsoleUsagesByCompany( string $companyUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/console/usage/companies/%s', $companyUid ) ); + public function patchLicensingReportsSettings(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest('/reports/settings', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @param string $companyUid - * - * @return RequestBuilder - * @deprecated + * Get License Usage Reports for Date Returns a collection resource representation of the Veeam license usage reports with the specified generation date. + * Path: /licensing/reports/{date} */ - public function getUsageOfVeeamBackupReplicationLicensesByCompany( string $companyUid ): RequestBuilder { - return $this->createGetRequest( '/backupServers/usage/companies/' . $companyUid ); + public function getLicensingReportsForDate(string $date, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/reports/%s', $date )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @return RequestBuilder - * @deprecated + * Download License Usage Report Returns a download link to a license usage report with the specified ID in the `CSV` format. + * Path: /licensing/reports/{id}/csv */ - public function getUsageOfVeeamBackupReplicationLicensesByAllCompanies(): RequestBuilder { - return $this->createGetRequest( '/backupServers/usage/companies' ); + public function downloadLicensingReportCsv(string $id): RequestBuilder { + return $this->createGetRequest(sprintf( '/reports/%s/csv', $id )); } - - + /** - * @return RequestBuilder - * @deprecated + * Get All Site Licenses Returns a collection resource representation of all licenses installed on the Veeam Cloud Connect sites. + * Path: /licensing/sites */ - public function getUsageOfAllVeeamBackupReplicationLicenses(): RequestBuilder { - return $this->createGetRequest( '/backupServers/usage' ); + public function getSiteLicenses(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/sites'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getAllVeeamBackupReplicationLicenses(): RequestBuilder { - return $this->createGetRequest( '/backupServers' ); + + /** + * Get Site License Returns a resource representation of a license installed on the Veeam Cloud Connect site with the specified UID. + * Path: /licensing/sites/{siteUid} + */ + public function getSiteLicense(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/sites/%s', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getVeeamBackupReplicationLicense( string $backupServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/backupServers/%s', $backupServerUid ) ); + + /** + * Modify Site License Modifies a license on a Veeam Cloud Connect site with the specified UID. + * Path: /licensing/sites/{siteUid} + */ + public function patchSiteLicense(string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/sites/%s', $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @param string $companyUid - * - * @return RequestBuilder - * @deprecated + * Install Site License Installs a license on the Veeam Cloud Connect site with the specified UID. + * Path: /licensing/sites/{siteUid} */ - public function getUsageOfVeeamBackupForMicrosoft365LicensesByCompany( string $companyUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/vbm365Servers/usage/companies/%s', $companyUid ) ); + public function installSiteLicense(string $siteUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/sites/%s', $siteUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @param string $backupServerUid - * - * @return RequestBuilder - * @deprecated + * Update Site License Downloads a license from the Internet and installs it on the Veeam Cloud Connect site with the specified UID. + * Path: /licensing/sites/{siteUid}/update */ - public function getUsageOfVeeamBackupReplicationLicense( string $backupServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/backupServers/%s/usage', $backupServerUid ) ); + public function updateSiteLicense(string $siteUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/sites/%s/update', $siteUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getVeeamBackupForMicrosoft365License( string $vbm365ServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/vb365Servers/%s', $vbm365ServerUid ) ); + + /** + * Get License Usage by All Organizations Returns a collection resource representation of license usage by all organizations. + * Path: /licensing/usage/organizations + */ + public function getOrganizationsLicenseUsage(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/usage/organizations'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - + /** - * @return RequestBuilder - * @deprecated + * Get All Veeam Backup for Microsoft 365 Licenses Returns a collection resource representation of the licenses installed on all managed Veeam Backup for Microsoft 365 servers. + * Path: /licensing/vb365Servers */ - public function getUsageOfAllVeeamBackupForMicrosoft365Licenses(): RequestBuilder { - return $this->createGetRequest( '/vbm365Servers/usage' ); + public function getVb365ServersLicenses(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getAllVeeamBackupForMicrosoft365Licenses(): RequestBuilder { - return $this->createGetRequest( '/vb365Servers' ); + + /** + * Get Veeam Backup for Microsoft 365 License Returns a resource representation of a license installed on a managed Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /licensing/vb365Servers/{vb365ServerUid} + */ + public function getVb365ServerLicense(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getLicenseUsageByAllOrganizations(): RequestBuilder { - return $this->createGetRequest( '/usage/organizations' ); + + /** + * Modify Veeam Backup for Microsoft 365 License Modifies a license on a managed Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /licensing/vb365Servers/{vb365ServerUid} + */ + public function patchVb365ServerLicense(string $vb365ServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/vb365Servers/%s', $vb365ServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getBackupServerLicense( string $serverUid ): RequestBuilder { - return $this->createGetRequest( sprintf( "/backupServers/%s", $serverUid ) ); + + /** + * Install Veeam Backup for Microsoft 365 License Install a license on a managed Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /licensing/vb365Servers/{vb365ServerUid} + */ + public function installVb365ServerLicense(string $vb365ServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/vb365Servers/%s', $vb365ServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Update Veeam Backup for Microsoft 365 License Downloads a new license from the Internet and installs it on a Veeam Backup for Microsoft 365 server. + * Path: /licensing/vb365Servers/{vb365ServerUid}/update + */ + public function updateVb365ServerLicense(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/vb365Servers/%s/update', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam One Licenses Returns a collection resource representation of the licenses installed on all managed Veeam One servers. + * Path: /licensing/voneServers + */ + public function getVOneServersLicenses(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/voneServers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Veeam One License Deletes a license from a managed Veeam One server with the specified UID. + * Path: /licensing/voneServers/{vOneServerUid} + */ + public function deleteVOneServerLicense(string $vOneServerUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/voneServers/%s', $vOneServerUid )); } - - - public function getBackupServersLicenses(): RequestBuilder { - return $this->createGetRequest( '/backupServers' ); + + /** + * Get Veeam One License Returns a resource representation of a license installed on a managed Veeam One server with the specified UID. + * Path: /licensing/voneServers/{vOneServerUid} + */ + public function getVOneServerLicense(string $vOneServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/voneServers/%s', $vOneServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getVb365ServersLicenses(): RequestBuilder { - return $this->createGetRequest( '/vb365Servers' ); + + /** + * Modify Veeam One License Modifies a license on a managed Veeam One server with the specified UID. + * Path: /licensing/voneServers/{vOneServerUid} + */ + public function patchVOneServerLicense(string $vOneServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/voneServers/%s', $vOneServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - - public function getVb365ServerLicense( string $serverUid ): RequestBuilder { - return $this->createGetRequest( '/vb365Servers/' . $serverUid ); + + /** + * Install Veeam One License Install a license on a managed Veeam One server with the specified UID. + * Path: /licensing/voneServers/{vOneServerUid} + */ + public function installVOneServerLicense(string $vOneServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/voneServers/%s', $vOneServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Update Veeam One License Downloads a new license from the Internet and installs it on a Veeam One server. + * Path: /licensing/voneServers/{vOneServerUid}/update + */ + public function updateVOneServerLicense(string $vOneServerUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/voneServers/%s/update', $vOneServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/LocationRepository.php b/src/Repositories/LocationRepository.php new file mode 100644 index 0000000..ce9e5b4 --- /dev/null +++ b/src/Repositories/LocationRepository.php @@ -0,0 +1,89 @@ +createGetRequest('/locations'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Location Creates a new organization location. + * Path: /organizations/locations + */ + public function createLocation(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/locations', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Location Deletes an organization location with the specified UID. + * Path: /organizations/locations/{locationUid} + */ + public function deleteLocation(string $locationUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/locations/%s', $locationUid )); + } + + /** + * Get Location Returns a resource representation of a organization location with the specified UID. + * Path: /organizations/locations/{locationUid} + */ + public function getLocation(string $locationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/locations/%s', $locationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Location Modifies an organization location. + * Path: /organizations/locations/{locationUid} + */ + public function patchLocation(string $locationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/locations/%s', $locationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organization Locations Returns a collection resource representation of all locations of an organization with the specified UID. + * Path: /organizations/{organizationUid}/locations + */ + public function getLocationsByOrganization(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/locations', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } +} diff --git a/src/Repositories/ManagementAgentsRepository.php b/src/Repositories/ManagementAgentsRepository.php index e247a33..131847b 100755 --- a/src/Repositories/ManagementAgentsRepository.php +++ b/src/Repositories/ManagementAgentsRepository.php @@ -1,29 +1,157 @@ -createGetRequest( '/packages/windows' ); - } - - - public function downloadManagementAgentSetupFileForLinux(): RequestBuilder { - return $this->createGetRequest( '/packages/linux' ); - } - - - public function downloadManagementAgentSetupFileForMacOS(): RequestBuilder { - return $this->createGetRequest( '/packages/mac' ); - } -} \ No newline at end of file +createGetRequest('/managementAgents'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Download Management Agent Setup File for Linux Returns a download link to a management agent setup file in the shell script format for Linux computers. + * Path: /infrastructure/managementAgents/packages/linux + */ + public function downloadLinuxManagementPackage(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/managementAgents/packages/linux'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Download Management Agent Setup File for macOS. Returns a download link to a management agent setup file in the shell script format for macOS computers. + * Path: /infrastructure/managementAgents/packages/mac + */ + public function downloadMacManagementPackage(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/managementAgents/packages/mac'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Download Management Agent Setup File for Windows Returns a download link to a management agent setup file in the `EXE` or `MSI` format for Microsoft Windows computers. + * Path: /infrastructure/managementAgents/packages/windows + */ + public function downloadWindowsManagementPackage(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/managementAgents/packages/windows'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Management Agent Deletes a management agent with the specified UID. > If the management agent is inaccessible, it will be deleted only on the Veeam Service Provider Console side and the operation response will contain a warning message. > Does not delete the unverified management agents and the management agents that are installed on the Veeam Cloud Connect servers. + * Path: /infrastructure/managementAgents/{managementAgentUid} + */ + public function deleteManagementAgent(string $managementAgentUid, array $query = []): RequestBuilder { + $request = $this->createDeleteRequest(sprintf( '/managementAgents/%s', $managementAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Management Agent Returns a resource representation of a management agent with the specified UID. + * Path: /infrastructure/managementAgents/{managementAgentUid} + */ + public function getManagementAgent(string $managementAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/managementAgents/%s', $managementAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Management Agent Modifies a management agent with the specified UID. + * Path: /infrastructure/managementAgents/{managementAgentUid} + */ + public function patchManagementAgent(string $managementAgentUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/managementAgents/%s', $managementAgentUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Reboot System on Managed Computer Runs system reboot on a computer where management agent with the specified UID is installed. Returns a positive response when the management agent receives the reboot task and not when the task is executed. + * Path: /infrastructure/managementAgents/{managementAgentUid}/reboot + */ + public function rebootSystemOnManagementAgent(string $managementAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/managementAgents/%s/reboot', $managementAgentUid )); + } + + /** + * Restart Management Agent Restarts a management agent with the specified UID. Returns a positive response when the management agent receives the restart task and not when the task is executed. + * Path: /infrastructure/managementAgents/{managementAgentUid}/restart + */ + public function restartManagementAgent(string $managementAgentUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/managementAgents/%s/restart', $managementAgentUid )); + } + + /** + * Get All Unverified Management Agents Returns a collection resource representation of all unverified management agents. + * Path: /infrastructure/unverifiedAgents + */ + public function getUnverifiedAgents(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/unverifiedAgents'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Unverified Management Agent Returns a resource representation of an unverified management agent with the specified UID. + * Path: /infrastructure/unverifiedAgents/{unverifiedAgentUid} + */ + public function getUnverifiedAgent(string $unverifiedAgentUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/unverifiedAgents/%s', $unverifiedAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Accept Unverified Management Agent Accepts an unverified management agent with the specified UID. + * Path: /infrastructure/unverifiedAgents/{unverifiedAgentUid}/accept + */ + public function acceptUnverifiedAgent(string $unverifiedAgentUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/unverifiedAgents/%s/accept', $unverifiedAgentUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } +} diff --git a/src/Repositories/Microsoft365ServerRepository.php b/src/Repositories/Microsoft365ServerRepository.php index 66b9943..4a67218 100755 --- a/src/Repositories/Microsoft365ServerRepository.php +++ b/src/Repositories/Microsoft365ServerRepository.php @@ -2,25 +2,508 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; +use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; +use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class Microsoft365ServerRepository implements Repository { + use CreateDeleteRequest; use CreateGetRequest; - + use CreatePatchRequest; + use CreatePostRequest; + public function getBaseRoute(): string { - return 'infrastructure/vb365Servers'; + return 'infrastructure'; + } + + /** + * Get All Unactivated Veeam Backup for Microsoft 365 Servers. Returns a collection resource representation of all unactivated Veeam Backup for Microsoft 365 servers. + * Path: /infrastructure/unactivatedVb365Servers + */ + public function getUnactivatedVb365Servers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/unactivatedVb365Servers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Unactivated Veeam Backup for Microsoft 365 Server Returns an resource representation of an Unactivated Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/unactivatedVb365Servers/{uniqueUid} + */ + public function getUnactivatedVb365Server(string $uniqueUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/unactivatedVb365Servers/%s', $uniqueUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Activate Unactivated Veeam Backup for Microsoft 365 Server Activates an unactivated Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/unactivatedVb365Servers/{uniqueUid}/activate + */ + public function activateVb365Server(string $uniqueUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/unactivatedVb365Servers/%s/activate', $uniqueUid )); + } + + /** + * Get All Connected Veeam Backup fot Microsoft 365 Servers. Returns a collection resource representation of all connected Veeam Backup for Microsoft 365 servers. + * Path: /infrastructure/vb365Servers + */ + public function getVb365Servers(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Microsoft Organizations Returns a collection resource representation of all Microsoft organizations. > Does not include hybrid and on-premises organizations. + * Path: /infrastructure/vb365Servers/organizations + */ + public function getVb365Organizations(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers/organizations'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAll(): RequestBuilder { - return $this->createGetRequest( '' ); + + /** + * Get All Microsoft Organization Mappings to Companies Returns a collection resource representation of all Microsoft organization mappings to companies. + * Path: /infrastructure/vb365Servers/organizations/companyMappings + */ + public function getVb365OrganizationsToCompanyMappings(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers/organizations/companyMappings'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Map Microsoft Organization to Company Maps a Microsoft organization to a company. + * Path: /infrastructure/vb365Servers/organizations/companyMappings + */ + public function createVb365OrganizationToCompanyMapping(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/vb365Servers/organizations/companyMappings', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Microsoft Organization to Company Mapping Deletes a Microsoft organization to company mapping with the specified UID. + * Path: /infrastructure/vb365Servers/organizations/companyMappings/{mappingUid} + */ + public function deleteVb365OrganizationToCompanyMapping(string $mappingUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/vb365Servers/organizations/companyMappings/%s', $mappingUid )); + } + + /** + * Get Microsoft Organization to Company Mapping Returns a resource representation of a Microsoft organization to company mapping with the specified UID. + * Path: /infrastructure/vb365Servers/organizations/companyMappings/{mappingUid} + */ + public function getVb365OrganizationToCompanyMapping(string $mappingUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/organizations/companyMappings/%s', $mappingUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Backup for Microsoft 365 Jobs Returns a collection resource representation of all Veeam Backup for Microsoft 365 jobs. + * Path: /infrastructure/vb365Servers/organizations/jobs + */ + public function getVb365Jobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers/organizations/jobs'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Veeam Backup for Microsoft 365 Backup Copy Jobs Returns a collection resource representation of all Veeam Backup for Microsoft 365 backup jobs. + * Path: /infrastructure/vb365Servers/organizations/jobs/backup + */ + public function getVb365BackupJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers/organizations/jobs/backup'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllRepositoriesForServer( string $vb365ServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/backupRepositories', $vb365ServerUid ) ); + + /** + * Get All Veeam Backup for Microsoft 365 Backup Copy Jobs Returns a collection resource representation of all Veeam Backup for Microsoft 365 backup copy jobs. + * Path: /infrastructure/vb365Servers/organizations/jobs/copy + */ + public function getVb365CopyJobs(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/vb365Servers/organizations/jobs/copy'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Veeam Backup for Microsoft 365 Server Disconnects Veeam Backup for Microsoft 365 server with the specified UID. > The operation is available only for hosted Veeam Backup for Microsoft 365 servers. If you want to disconnect a client server, delete a management agent installed on that server. + * Path: /infrastructure/vb365Servers/{vb365ServerUid} + */ + public function deleteVb365Server(string $vb365ServerUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/vb365Servers/%s', $vb365ServerUid )); + } + + /** + * Get Veeam Backup for Microsoft 365 Server Returns a resource representation of a connected Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid} + */ + public function getVb365Server(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Proxies Connected to Veeam Backup for Microsoft 365 Server Returns a collection resource representation of all backup proxies connected to a Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/backupProxies + */ + public function getVb365BackupProxies(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/backupProxies', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Proxy Pools Connected to Veeam Backup for Microsoft 365 Server Returns a collection resource representation of all backup proxy pools connected to a Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/backupProxyPools + */ + public function getVb365BackupProxyPools(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/backupProxyPools', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Backup Repositories Connected to Veeam Backup for Microsoft 365 Server Returns a collection resource representation of all backup repositories connected to a Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/backupRepositories + */ + public function getVb365BackupRepositories(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/backupRepositories', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Enforce Data Collection from Veeam Backup for Microsoft 365 Server Enforces data collection from a Veeam Backup for Microsoft 365 server with the specified UID. > Returns a positive response when the collection task is added to the internal queue and not when the task is executed.' + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/collect + */ + public function forceCollectVb365Server(string $vb365ServerUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/vb365Servers/%s/collect', $vb365ServerUid )); + } + + /** + * Get All Microsoft Organizations Managed by Veeam Backup for Microsoft 365 Server Returns a collection resource representation of all Microsoft organizations managed by Veeam Backup for Microsoft 365 server with the spectified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations + */ + public function getVb365OrganizationsByVb365Server(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Microsoft 365 Organizations Managed by Veeam Backup for Microsoft 365 Server Returns a collection resource representation of all Microsoft 365 organizations managed by a Veeam Backup for Microsoft 365 server with the spectified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/Microsoft365 + */ + public function getVb365Microsoft365Organizations(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/Microsoft365', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Microsoft 365 Organization Creates a new Microsoft 365 organization on a Veeam Backup for Microsoft 365 server with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/Microsoft365 + */ + public function createVb365Microsoft365Organization(string $vb365ServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/Microsoft365', $vb365ServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Microsoft 365 Organization Returns a resource representation of a Microsoft 365 organization with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/Microsoft365/{vb365OrganizationUid} + */ + public function getVb365Microsoft365Organization(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/Microsoft365/%s', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Microsoft 365 Organization Modifies a Microsoft 365 organization with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/Microsoft365/{vb365OrganizationUid} + */ + public function patchVb365Microsoft365Organization(string $vb365ServerUid, string $vb365OrganizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/vb365Servers/%s/organizations/Microsoft365/%s', $vb365ServerUid, $vb365OrganizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Check Microsoft 365 Organization Application Certificate Checks whether a security certificate is available for a Microsoft 365 organization application with the specified UID. > If a Microsoft 365 organization was not created in Veeam Service Provider Console, its application certificate is not available. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/Microsoft365/{vb365OrganizationUid}/certificate/exist + */ + public function checkVb365Microsoft365OrganizationCertificateExistenceInTheStorage(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/Microsoft365/%s/certificate/exist', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Device Code Generates a device code to log in to a Microsoft organization. > You can get a device code from Microsoft Azure to sign in to the [Microsoft authentication portal](https://login.microsoftonline.com/common/oauth2/deviceauth). + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/deviceCode + */ + public function createAzureDeviceCode(string $vb365ServerUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/deviceCode', $vb365ServerUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Device Code Status Returns a resource representation of a device code status. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/deviceCode/{code}/status + */ + public function getAzureDeviceCodeStatus(string $vb365ServerUid, string $code, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/deviceCode/%s/status', $vb365ServerUid, $code )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Backup for Microsoft 365 Backup Job Returns a resource representation of a Veeam Backup for Microsoft 365 backup job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/backup/{vb365BackupJobUid} + */ + public function getVb365BackupJob(string $vb365ServerUid, string $vb365BackupJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/jobs/backup/%s', $vb365ServerUid, $vb365BackupJobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Veeam Backup for Microsoft 365 Backup Job Modifies a Veeam Backup for Microsoft 365 backup job with the specified UID. > [For Veeam Backup for Microsoft 365 servers hosted by Veeam Service Provider Console] Company users must not modify the `schedulePolicy` property. Otherwise the operation will result in error. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/backup/{vb365BackupJobUid} + */ + public function patchVb365BackupJob(string $vb365ServerUid, string $vb365BackupJobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/vb365Servers/%s/organizations/jobs/backup/%s', $vb365ServerUid, $vb365BackupJobUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Available Backup Repositories for Veeam Backup for Microsoft 365 Backup Job Returns a collection resource representation of backup repositories that can be selected as target repositories of a Veeam Backup for Microsoft 365 backup job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/backup/{vb365BackupJobUid}/availableBackupRepositories + */ + public function getVb365BackupJobAvailableBackupRepositories(string $vb365ServerUid, string $vb365BackupJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/jobs/backup/%s/availableBackupRepositories', $vb365ServerUid, $vb365BackupJobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Veeam Backup for Microsoft 365 Backup Copy Job Creates a new Veeam Backup for Microsoft 365 backup copy job. > You can save the job schedule only if that functionality is enabled for you in the Veeam Backup for Microsoft 365 resource configuration. Otherwise the operation will result in error. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/copy + */ + public function createVb365CopyJob(string $vb365ServerUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/jobs/copy', $vb365ServerUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Veeam Backup for Microsoft 365 Backup Copy Job Returns a resource representation of a Veeam Backup for Microsoft 365 backup copy job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/copy/{vb365CopyJobUid} + */ + public function getVb365CopyJob(string $vb365ServerUid, string $vb365CopyJobUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/jobs/copy/%s', $vb365ServerUid, $vb365CopyJobUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Veeam Backup for Microsoft 365 Backup Copy Job Modifies a Veeam Backup for Microsoft 365 backup copy job with the specified UID. > You can save the job schedule only if that functionality is enabled for you in the Veeam Backup for Microsoft 365 resource configuration. Otherwise the operation will result in error. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/copy/{vb365CopyJobUid} + */ + public function patchVb365CopyJob(string $vb365ServerUid, string $vb365CopyJobUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/vb365Servers/%s/organizations/jobs/copy/%s', $vb365ServerUid, $vb365CopyJobUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete Veeam Backup for Microsoft 365 Job Deletes a Veeam Backup for Microsoft 365 job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/{vb365JobUid} + */ + public function deleteVb365Job(string $vb365ServerUid, string $vb365JobUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/vb365Servers/%s/organizations/jobs/%s', $vb365ServerUid, $vb365JobUid )); + } + + /** + * Disable Veeam Backup for Microsoft 365 Job Disables a Veeam Backup for Microsoft 365 job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/{vb365JobUid}/disable + */ + public function disableVb365Job(string $vb365ServerUid, string $vb365JobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/jobs/%s/disable', $vb365ServerUid, $vb365JobUid )); + } + + /** + * Enable Veeam Backup for Microsoft 365 Job Enables a Veeam Backup for Microsoft 365 job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/{vb365JobUid}/enable + */ + public function enableVb365Job(string $vb365ServerUid, string $vb365JobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/jobs/%s/enable', $vb365ServerUid, $vb365JobUid )); + } + + /** + * Start Veeam Backup for Microsoft 365 Job Starts a Veeam Backup for Microsoft 365 job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/{vb365JobUid}/start + */ + public function startVb365Job(string $vb365ServerUid, string $vb365JobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/jobs/%s/start', $vb365ServerUid, $vb365JobUid )); + } + + /** + * Stop Veeam Backup for Microsoft 365 Job Stops a Veeam Backup for Microsoft 365 job with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/jobs/{vb365JobUid}/stop + */ + public function stopVb365Job(string $vb365ServerUid, string $vb365JobUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/jobs/%s/stop', $vb365ServerUid, $vb365JobUid )); + } + + /** + * Delete Microsoft Organization Deletes a Microsoft organization with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid} + */ + public function deleteVb365Organization(string $vb365ServerUid, string $vb365OrganizationUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/vb365Servers/%s/organizations/%s', $vb365ServerUid, $vb365OrganizationUid )); + } + + /** + * Get Microsoft Organization Returns a resource representation of a Microsoft organization with the specified UID. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid} + */ + public function getVb365Organization(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/%s', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Microsoft Organization Groups Returns a collection resource representation of all groups in a Microsoft organization with the specified UID. > The `total` property of the `meta` response section always has the `0` value. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid}/groups + */ + public function getVb365OrganizationGroups(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/%s/groups', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Create Veeam Backup for Microsoft 365 Backup Job Creates a new Veeam Backup for Microsoft 365 backup job. > [For Veeam Backup for Microsoft 365 servers hosted by Veeam Service Provider Console] Company users must pass the `null` value for the `schedulePolicy` property. Otherwise the operation will result in error. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid}/jobs/backup + */ + public function createVb365BackupJob(string $vb365ServerUid, string $vb365OrganizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/vb365Servers/%s/organizations/%s/jobs/backup', $vb365ServerUid, $vb365OrganizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Microsoft Organization Sites Returns a collection resource representation of all sites of a Microsoft organization with the specified UID. > The `total` property of the `meta` response section always has the `0` value. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid}/sites + */ + public function getVb365OrganizationSites(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/%s/sites', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Microsoft Organization Teams Returns a collection resource representation of all teams of a Microsoft organization with the specified UID. > The `total` property of the `meta` response section always has the `0` value. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid}/teams + */ + public function getVb365OrganizationTeams(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/%s/teams', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } - public function getAllProxiesForServer( string $vb365ServerUid ): RequestBuilder { - return $this->createGetRequest( sprintf( '/%s/backupProxies', $vb365ServerUid ) ); + /** + * Get All Microsoft Organization Users Returns a collection resource representation of all users of a Microsoft organization with the specified UID. > The `total` property of the `meta` response section always has the `0` value. + * Path: /infrastructure/vb365Servers/{vb365ServerUid}/organizations/{vb365OrganizationUid}/users + */ + public function getVb365OrganizationUsers(string $vb365ServerUid, string $vb365OrganizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/vb365Servers/%s/organizations/%s/users', $vb365ServerUid, $vb365OrganizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/MiscRepository.php b/src/Repositories/MiscRepository.php index b219fff..71943be 100755 --- a/src/Repositories/MiscRepository.php +++ b/src/Repositories/MiscRepository.php @@ -7,12 +7,56 @@ class MiscRepository implements Repository { use CreateGetRequest; - + public function getBaseRoute(): string { - return 'misc'; + return ''; + } + + /** + * Get Time Zones Returns a collection resource representation of all time zones. + * Path: /discovery/timeZones + */ + public function getTimeZones(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/discovery/timeZones'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Countries Returns a collection resource representation of all countries. + * Path: /misc/countries + */ + public function getCountries(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/misc/countries'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Currencies Returns a collection resource representation of all currencies. + * Path: /misc/currencies + */ + public function getCurrencies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/misc/currencies'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllCountries(): RequestBuilder { - return $this->createGetRequest( '/countries' ); + + /** + * Get All USA States Returns a collection resource representation of all USA states. + * Path: /misc/usaStates + */ + public function getUsaStates(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/misc/usaStates'); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Repositories/OrganizationRepository.php b/src/Repositories/OrganizationRepository.php index b01db1c..5cc1205 100755 --- a/src/Repositories/OrganizationRepository.php +++ b/src/Repositories/OrganizationRepository.php @@ -1,18 +1,305 @@ -createGetRequest( sprintf( '/%s', $organizationUid ) ); - } -} \ No newline at end of file +createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Custom Settings of Email Notification Returns a collection resource representation of all custom settings configured for email notifications. + * Path: /organizations/configuration/notification/welcomeEmails + */ + public function getCustomWelcomeEmailTemplates(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/configuration/notification/welcomeEmails'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization Returns a resource representation of an organization with the specified UID. + * Path: /organizations/{organizationUid} + */ + public function getOrganization(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Organization Modifies an organization with the specified UID. + * Path: /organizations/{organizationUid} + */ + public function patchOrganization(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Organization Alarm Templates Returns a resource representation of all alarm templates configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/alarms + */ + public function getOrganizationAlarms(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/alarms', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Disable Organization Alarm Templates Disables all alarm templates configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/alarms/disable + */ + public function disableOrganizationAlarms(string $organizationUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/configuration/alarms/disable', $organizationUid )); + } + + /** + * Enable Organization Alarm Templates Enables all alarm templates configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/alarms/enable + */ + public function enableOrganizationAlarms(string $organizationUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/configuration/alarms/enable', $organizationUid )); + } + + /** + * Get Organization Automatic Deployment Settings Returns a resource representation of Veeam backup agent automatic deployment settings configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/autodeployment + */ + public function getOrganizationAutoDeploymentSettings(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/autodeployment', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Organization Automatic Deployment Settings Modifies Veeam backup agent automatic deployment settings configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/autodeployment + */ + public function patchOrganizationAutoDeploymentSettings(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/configuration/autodeployment', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization Branding Settings Returns a resource representation of branding settings of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/branding + */ + public function getOrganizationBrandingSettings(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/branding', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Organization Branding Settings Modifies branding settings of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/branding + */ + public function patchOrganizationBrandingSettings(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/configuration/branding', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization Portal URL Returns a resource representation of a portal URL configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/loginUrl + */ + public function getOrganizationLoginUrl(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/loginUrl', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Replace Organization Portal URL Replaces a portal configured for an organization with the specified UID. > Applies a portal URL to organizations that has no portal URL configured. > If the organization is a company and it has at least one configured IdP the operation will return an error with the 1000 code. > If the specified URL is already occupied by another organization the operation will return an error with the 10500 code. + * Path: /organizations/{organizationUid}/configuration/loginUrl + */ + public function replaceOrganizationLoginUrl(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createPutRequest(sprintf( '/%s/configuration/loginUrl', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization Notification Settings Returns a resource representation of notification settings of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification + */ + public function getOrganizationNotificationSettings(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/notification', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Organization Notification Settings Modifies notification settings of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification + */ + public function patchOrganizationNotificationSettings(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/configuration/notification', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Send SMTP Server OAuth 2.0 Authorization Request Sends an OAuth 2.0 authorization request to access an SMTP server for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification/oauth2/signin + */ + public function prepareSmtpOAuth2SignIn(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/configuration/notification/oauth2/signin', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Obtain SMTP Server OAuth 2.0 Authorization Tokens Returns a pair of OAuth 2.0 authorization tokens to access an SMTP server for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification/oauth2/signin/completion + */ + public function completeSmtpOAuth2SignIn(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/notification/oauth2/signin/completion', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Test SMTP Server Settings Checks provided SMTP server settings. Returns updated and corrected settings and additional information on SMTP server. + * Path: /organizations/{organizationUid}/configuration/notification/smtp/test + */ + public function testNotificationSmtpSettings(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/configuration/notification/smtp/test', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Test Email Notifications Sends test email message with the specified settings. + * Path: /organizations/{organizationUid}/configuration/notification/test + */ + public function sendTestNotificationEmail(string $organizationUid, ?Payload $payload = null): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/configuration/notification/test', $organizationUid ), $payload); + } + + /** + * Get Custom Settings of Organization Email Notifications Returns a resource representation of custom settings configured for email notifications of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification/welcomeEmail + */ + public function getCustomWelcomeEmailTemplate(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/notification/welcomeEmail', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Custom Settings of Organization Email Notifications Modifies custom settings configured for email notification of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification/welcomeEmail + */ + public function patchCustomWelcomeEmailTemplate(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/configuration/notification/welcomeEmail', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Configure Custom Settings for Organization Email Notifications Configures custom settings for email notifications of an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/notification/welcomeEmail + */ + public function createCustomWelcomeEmailTemplate(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/%s/configuration/notification/welcomeEmail', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Organization Policy Settings Returns a resource representation of policy settings configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/policy + */ + public function getOrganizationPolicySettings(string $organizationUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/%s/configuration/policy', $organizationUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify Organization Policy Settings Modifies policy settings configured for an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/policy + */ + public function patchOrganizationPolicySettings(string $organizationUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/%s/configuration/policy', $organizationUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Refresh Organization Security Token Refreshes a security token issued to an organization with the specified UID. + * Path: /organizations/{organizationUid}/configuration/refreshsecuritytoken + */ + public function refreshSecurityToken(string $organizationUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/%s/configuration/refreshsecuritytoken', $organizationUid )); + } +} diff --git a/src/Repositories/ProviderRepository.php b/src/Repositories/ProviderRepository.php new file mode 100644 index 0000000..aba55d6 --- /dev/null +++ b/src/Repositories/ProviderRepository.php @@ -0,0 +1,38 @@ +createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get Companies Managed by Service Provider Returns a collection resource representation of all companies managed by a service provider. + * Path: /organizations/provider/companies + */ + public function getProviderCompanies(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/companies'); + if ($query !== []) { + $request->query($query); + } + return $request; + } +} diff --git a/src/Repositories/PulseRepository.php b/src/Repositories/PulseRepository.php index 65644c9..a65263a 100755 --- a/src/Repositories/PulseRepository.php +++ b/src/Repositories/PulseRepository.php @@ -2,53 +2,236 @@ namespace Shellrent\VeeamVspcApiClient\Repositories; -use Shellrent\VeeamVspcApiClient\Payloads\AddLicenseToVCSPPulsePayload; -use Shellrent\VeeamVspcApiClient\Payloads\EditPulseTenantPayload; -use Shellrent\VeeamVspcApiClient\Payloads\ModifyLicenseManagedInVCSPPulsePayload; +use Shellrent\VeeamVspcApiClient\Payloads\Payload; +use Shellrent\VeeamVspcApiClient\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePostRequest; use Shellrent\VeeamVspcApiClient\Support\RequestBuilder; class PulseRepository implements Repository { - use CreatePostRequest; - + use CreateDeleteRequest; + use CreateGetRequest; use CreatePatchRequest; + use CreatePostRequest; - use CreateGetRequest; - public function getBaseRoute(): string { return 'pulse'; } - - public function getAllRentalAgreementContracts(): RequestBuilder { - return $this->createGetRequest( '/contracts' ); + + /** + * Get VCSP Pulse Configuration Returns a resource representation of VCSP Pulse plugin configuration. + * Path: /pulse + */ + public function getPulseConfiguration(array $query = []): RequestBuilder { + $request = $this->createGetRequest(''); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify VCSP Pulse Configuration Modifies VCSP Pulse plugin configuration. > To disconnect the plugin, replace the `token` property value with `null`. + * Path: /pulse + */ + public function patchPulseConfiguration(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest('', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Rental Agreement Contracts Returns a collection resource representation of all rental agreement contracts. + * Path: /pulse/contracts + */ + public function getPulseLicenseContracts(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/contracts'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Get All Licenses Managed in VCSP Pulse Rerurns a collection resource representation of all licenses managed in VCSP Pulse. + * Path: /pulse/licenses + */ + public function getPulseLicenses(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/licenses'); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Add License to VCSP Pulse Adds a new license configuration with the specified parameters to VCSP Pulse. + * Path: /pulse/licenses + */ + public function createPulseLicense(?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPostRequest('/licenses', $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Delete License Managed in VCSP Pulse. Deletes a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid} + */ + public function deletePulseLicense(string $licenseUid): RequestBuilder { + return $this->createDeleteRequest(sprintf( '/licenses/%s', $licenseUid )); + } + + /** + * Get License Managed in VCSP Pulse Rerurns a resource representation of a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid} + */ + public function getPulseLicense(string $licenseUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/licenses/%s', $licenseUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify License Managed in VCSP Pulse Modifies a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid} + */ + public function patchPulseLicense(string $licenseUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/licenses/%s', $licenseUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Copy License Managed in VCSP Pulse Creates a copy of a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid}/copy + */ + public function copyPulseLicense(string $licenseUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/licenses/%s/copy', $licenseUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Download License Managed in VCSP Pulse Downloads a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid}/download + */ + public function downloadPulseLicense(string $licenseUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/licenses/%s/download', $licenseUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Install License Managed in VCSP Pulse Installs a license managed in VCSP Pulse with the specified UID. >License must be issued to a company on whose server it will be installed. It also must not be installed on any other server. >Otherwise, the operation will create a copy of the license and install it on the server. + * Path: /pulse/licenses/{licenseUid}/install + */ + public function installPulseLicense(string $licenseUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/licenses/%s/install', $licenseUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Revoke License Managed in VCSP Pulse Revokes a license managed in VCSP Pulse with the specified UID. + * Path: /pulse/licenses/{licenseUid}/revoke + */ + public function revokePulseLicense(string $licenseUid): RequestBuilder { + return $this->createPostRequest(sprintf( '/licenses/%s/revoke', $licenseUid )); } - - public function getPulseTenants() { - return $this->createGetRequest( '/tenants' ); + + /** + * Get Veeam Products Available in VCSP Pulse Returns a collection resource representation of all Veeam products managed in VCSP Pulse. + * Path: /pulse/products + */ + public function getPulseLicenseProducts(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/products'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function patchPulseTenant( string $tenantUid, EditPulseTenantPayload $payload ) { - return $this->createPatchRequest( sprintf( '/tenants/%s', $tenantUid ), $payload ); + + /** + * Synchronize with VCSP Pulse Portal Initiates synchronization with the VCSP Pulse portal. + * Path: /pulse/sync + */ + public function syncPulseData(): RequestBuilder { + return $this->createPostRequest('/sync'); } - - public function postCreatePulseTenantByCompany( string $companyUid ) { - return $this->createPostRequest( '/tenants' ) - ->query( [ - 'companyUid' => $companyUid - ] ); + + /** + * Get All VCSP Pulse Tenants Returns a collection resource representation of all VCSP Pulse tenants. + * Path: /pulse/tenants + */ + public function getPulseTenants(array $query = []): RequestBuilder { + $request = $this->createGetRequest('/tenants'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function postAddLicenseToVCSPPulse( AddLicenseToVCSPPulsePayload $payload ): RequestBuilder { - return $this->createPostRequest( '/licenses', $payload ); + + /** + * Create VCSP Pulse Tenant Creates a VCSP Pulse tenant based on a specific company. + * Path: /pulse/tenants + */ + public function createPulseTenantByCompany(array $query = []): RequestBuilder { + $request = $this->createPostRequest('/tenants'); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function patchModifyLicenseManagedInVCSPPulse( string $licenseUid, ModifyLicenseManagedInVCSPPulsePayload $payload ): RequestBuilder { - return $this->createPatchRequest( sprintf( '/licenses/%s', $licenseUid ), $payload ); + + /** + * Get VCSP Pulse Tenant Returns a resource representation of a VCSP Pulse tenant with the specified UID. + * Path: /pulse/tenants/{tenantUid} + */ + public function getPulseTenant(string $tenantUid, array $query = []): RequestBuilder { + $request = $this->createGetRequest(sprintf( '/tenants/%s', $tenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; + } + + /** + * Modify VCSP Pulse Tenant Modifies a VCSP Pulse tenant with the specified UID. + * Path: /pulse/tenants/{tenantUid} + */ + public function patchPulseTenant(string $tenantUid, ?Payload $payload = null, array $query = []): RequestBuilder { + $request = $this->createPatchRequest(sprintf( '/tenants/%s', $tenantUid ), $payload); + if ($query !== []) { + $request->query($query); + } + return $request; } - - public function getAllLicensesManagedInVcspPulse(): RequestBuilder { - return $this->createGetRequest( '/licenses' ); + + /** + * Create Company from VCSP Tenant Creates a company based on VCSP Pulse tenant with the specified UID. + * Path: /pulse/tenants/{tenantUid}/createCompany + */ + public function createCompanyByPulseTenant(string $tenantUid, array $query = []): RequestBuilder { + $request = $this->createPostRequest(sprintf( '/tenants/%s/createCompany', $tenantUid )); + if ($query !== []) { + $request->query($query); + } + return $request; } } diff --git a/src/Support/CreatePatchRequest.php b/src/Support/CreatePatchRequest.php index 059968f..baff036 100755 --- a/src/Support/CreatePatchRequest.php +++ b/src/Support/CreatePatchRequest.php @@ -5,13 +5,13 @@ use Shellrent\VeeamVspcApiClient\Payloads\Payload; trait CreatePatchRequest { - protected function createPatchRequest( string $url, ?Payload $payload = null, array $options = [] ): RequestBuilder { - $uri = $this->getBaseRoute() . $url; - - if ( $payload->getContentType() ) { - $options['Content-Type'] = $payload->getContentType(); - } - - return ( new RequestBuilder( 'PATCH', $uri, $options, $payload ? $payload->getBody() : null ) ); - } + protected function createPatchRequest( string $url, ?Payload $payload = null, array $options = [] ): RequestBuilder { + $uri = $this->getBaseRoute() . $url; + + if ( $payload && $payload->getContentType() ) { + $options['Content-Type'] = $payload->getContentType(); + } + + return new RequestBuilder( 'PATCH', $uri, $options, $payload ? $payload->getBody() : null ); + } } diff --git a/src/Support/CreatePutRequest.php b/src/Support/CreatePutRequest.php new file mode 100644 index 0000000..bfa0096 --- /dev/null +++ b/src/Support/CreatePutRequest.php @@ -0,0 +1,17 @@ +getBaseRoute() . $url; + + if ( $payload && $payload->getContentType() ) { + $options['Content-Type'] = $payload->getContentType(); + } + + return new RequestBuilder( 'PUT', $uri, $options, $payload ? $payload->getBody() : null ); + } +}