diff --git a/src/Payloads/CreateCompanyMicrosoft365BackupResourcePayload.php b/src/Payloads/CreateCompanyMicrosoft365BackupResourcePayload.php new file mode 100755 index 0000000..28cb961 --- /dev/null +++ b/src/Payloads/CreateCompanyMicrosoft365BackupResourcePayload.php @@ -0,0 +1,68 @@ +RepositoryUid = $RepositoryUid; + + return $this; + } + + + /** + * @param mixed $ProxyUid + */ + public function setProxyUid( $ProxyUid ) { + $this->ProxyUid = $ProxyUid; + + return $this; + } + + + /** + * @param mixed $UsersQuota + */ + public function setUsersQuota( $UsersQuota ) { + $this->UsersQuota = $UsersQuota; + + return $this; + } + + + /** + * @param mixed $IsUsersQuotaUnlimited + */ + public function setIsUsersQuotaUnlimited( $IsUsersQuotaUnlimited ) { + $this->IsUsersQuotaUnlimited = $IsUsersQuotaUnlimited; + + return $this; + } + + public function getBody() { + $body = [ + "repositoryUid" => $this->RepositoryUid, + "proxyUid" => $this->ProxyUid, + "usersQuota" => $this->UsersQuota ?? null, + "isUsersQuotaUnlimited" => $this->IsUsersQuotaUnlimited ?? null, + ]; + + return json_encode( $body ); + } + + public function getContentType(): string { + return 'application/json'; + } +} \ No newline at end of file diff --git a/src/Payloads/CreateCompanyMicrosoft365ResourcePayload.php b/src/Payloads/CreateCompanyMicrosoft365ResourcePayload.php new file mode 100755 index 0000000..52cc8c7 --- /dev/null +++ b/src/Payloads/CreateCompanyMicrosoft365ResourcePayload.php @@ -0,0 +1,54 @@ +Vb365ServerUid = $Vb365ServerUid; + + return $this; + } + + + /** + * @param mixed $FriendlyName + */ + public function setFriendlyName( $FriendlyName ) { + $this->FriendlyName = $FriendlyName; + + return $this; + } + + + /** + * @param mixed $IsJobSchedulingEnabled + */ + public function setIsJobSchedulingEnabled( $IsJobSchedulingEnabled ) { + $this->IsJobSchedulingEnabled = $IsJobSchedulingEnabled; + + return $this; + } + + public function getBody() { + $body = [ + "vb365ServerUid" => $this->Vb365ServerUid, + "friendlyName" => $this->FriendlyName, + "isJobSchedulingEnabled" => $this->IsJobSchedulingEnabled ?? false, + ]; + + return json_encode( $body ); + } + + public function getContentType(): string { + return 'application/json'; + } +} \ No newline at end of file diff --git a/src/Payloads/ModifyCompanyResourcePayload.php b/src/Payloads/ModifyCompanyResourcePayload.php new file mode 100755 index 0000000..f0e256c --- /dev/null +++ b/src/Payloads/ModifyCompanyResourcePayload.php @@ -0,0 +1,47 @@ +UsersQuota = $UsersQuota; + + return $this; + } + + public function setUsersQuotaUnlimited( ?int $UsersQuotaUnlimited ) { + $this->UsersQuotaUnlimited = $UsersQuotaUnlimited; + + return $this; + } + + public function getBody() { + $body = []; + + if ( !is_null( $this->UsersQuota ) ) { + $body[] = [ + 'value' => $this->UsersQuota, + 'path' => '/usersQuota', + 'op' => 'replace', + ]; + } + + if ( !is_null( $this->UsersQuotaUnlimited ) ) { + $body[] = [ + 'value' => $this->UsersQuotaUnlimited, + 'path' => '/isUsersQuotaUnlimited', + 'op' => 'replace', + ]; + } + + return json_encode( $body ); + } + + public function getContentType(): string { + return 'application/json'; + } +} \ No newline at end of file diff --git a/src/Repositories/CompanyRepository.php b/src/Repositories/CompanyRepository.php index 0aefaeb..4df35a1 100755 --- a/src/Repositories/CompanyRepository.php +++ b/src/Repositories/CompanyRepository.php @@ -3,10 +3,13 @@ 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\Support\CreateDeleteRequest; use Shellrent\VeeamVspcApiClient\Support\CreateGetRequest; use Shellrent\VeeamVspcApiClient\Support\CreatePatchRequest; @@ -30,6 +33,10 @@ public function getAll(): RequestBuilder { return $this->createGetRequest( '/' ); } + public function getAllSites( string $companyUid ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/sites', $companyUid ) ); + } + public function getAllCompanyBackupResources( string $companyUid, string $siteUid ): RequestBuilder { return $this->createGetRequest( sprintf( '/%s/sites/%s/backupResources', $companyUid, $siteUid ) ); } @@ -70,9 +77,38 @@ public function deleteCompanyBackupResource( string $companyUid, string $siteUid return $this->createDeleteRequest( sprintf( '/%s/sites/%s/backupResources/%s', $companyUid, $siteUid, $resourceUid ) ); } + public function getAllCompanyVb365Resources( string $companyId ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/vb365Resources', $companyId ) ); + } - public function getAllSites( string $companyUid ) { - return $this->createGetRequest( sprintf( '/%s/sites', $companyUid ) ); - + public function getAllCompanyVb365BackupResources( string $companyId, string $vb365ResourceUid ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/vb365Resources/%s/backupResources', $companyId, $vb365ResourceUid ) ); + } + + public function getCompanyVb365BackupResource( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/vb365Resources/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ) ); + } + + public function patchModifyCompanyVb365Resource( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid, ModifyCompanyResourcePayload $request ): RequestBuilder { + return $this->createPatchRequest( + sprintf( '/%s/vb365Resources/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ), + $request + ); + } + + public function deleteCompanyVb365Resource( string $companyId, string $vb365ResourceUid ): RequestBuilder { + return $this->createDeleteRequest( sprintf( '/%s/vb365Resources/%s', $companyId, $vb365ResourceUid ) ); + } + + public function deleteCompanyVb365BackupResources( string $companyId, string $vb365ResourceUid, string $vb365BackupResourceUid ): RequestBuilder { + return $this->createDeleteRequest( sprintf( '/%s/vb365Resources/%s/backupResources/%s', $companyId, $vb365ResourceUid, $vb365BackupResourceUid ) ); + } + + public function createCompanyVb365Resource( string $companyId, CreateCompanyMicrosoft365ResourcePayload $request ): RequestBuilder { + return $this->createPostRequest( sprintf( '/%s/vb365Resources', $companyId ), $request ); + } + + public function createCompanyVb365BackupResource( string $companyId, string $vb365ResourceUid, CreateCompanyMicrosoft365BackupResourcePayload $request ): RequestBuilder { + return $this->createPostRequest( sprintf( '/%s/vb365Resources/%s/backupResources', $companyId, $vb365ResourceUid ), $request ); } } diff --git a/src/Repositories/Microsoft365ServerRepository.php b/src/Repositories/Microsoft365ServerRepository.php index 7a5b1da..66b9943 100755 --- a/src/Repositories/Microsoft365ServerRepository.php +++ b/src/Repositories/Microsoft365ServerRepository.php @@ -15,4 +15,12 @@ public function getBaseRoute(): string { public function getAll(): RequestBuilder { return $this->createGetRequest( '' ); } + + public function getAllRepositoriesForServer( string $vb365ServerUid ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/backupRepositories', $vb365ServerUid ) ); + } + + public function getAllProxiesForServer( string $vb365ServerUid ): RequestBuilder { + return $this->createGetRequest( sprintf( '/%s/backupProxies', $vb365ServerUid ) ); + } }