Skip to content

Commit 1c1b1d4

Browse files
committed
QuotaSet update method fix
1 parent 300958b commit 1c1b1d4

File tree

3 files changed

+99
-10
lines changed

3 files changed

+99
-10
lines changed

src/Compute/v2/Api.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,22 @@ public function putQuotaSet()
711711
'path' => 'os-quota-sets/{tenantId}',
712712
'jsonKey' => 'quota_set',
713713
'params' => [
714-
'tenantId' => $this->params->idPath(),
715-
'instances' => $this->params->quotaSetLimitInstances()
714+
'tenantId' => $this->params->idPath(),
715+
'force' => $this->notRequired($this->params->quotaSetLimitForce()),
716+
'instances' => $this->notRequired($this->params->quotaSetLimitInstances()),
717+
'cores' => $this->notRequired($this->params->quotaSetLimitCores()),
718+
'fixedIps' => $this->notRequired($this->params->quotaSetLimitFixedIps()),
719+
'floatingIps' => $this->notRequired($this->params->quotaSetLimitFloatingIps()),
720+
'injectedFileContentBytes' => $this->notRequired($this->params->quotaSetLimitInjectedFileContentBytes()),
721+
'injectedFilePathBytes' => $this->notRequired($this->params->quotaSetLimitInjectedFilePathBytes()),
722+
'injectedFiles' => $this->notRequired($this->params->quotaSetLimitInjectedFiles()),
723+
'keyPairs' => $this->notRequired($this->params->quotaSetLimitKeyPairs()),
724+
'metadataItems' => $this->notRequired($this->params->quotaSetLimitMetadataItems()),
725+
'ram' => $this->notRequired($this->params->quotaSetLimitRam()),
726+
'securityGroupRules' => $this->notRequired($this->params->quotaSetLimitSecurityGroupRules()),
727+
'securityGroups' => $this->notRequired($this->params->quotaSetLimitSecurityGroups()),
728+
'serverGroups' => $this->notRequired($this->params->quotaSetLimitServerGroups()),
729+
'serverGroupMembers' => $this->notRequired($this->params->quotaSetLimitServerGroupMembers()),
716730
]
717731
];
718732
}

src/Compute/v2/Models/QuotaSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function retrieve()
155155
*/
156156
public function delete()
157157
{
158-
$response = $this->executeWithState($this->api->putQuotaSet());
158+
$response = $this->executeWithState($this->api->deleteQuotaSet());
159159
$this->populateFromResponse($response);
160160
}
161161

src/Compute/v2/Params.php

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function blockDeviceMapping(): array
253253
'items' => [
254254
'type' => self::OBJECT_TYPE,
255255
'properties' => [
256-
'uuid' => [
256+
'uuid' => [
257257
'type' => self::STRING_TYPE,
258258
'description' => 'The unique ID for the volume which the server is to be booted from.',
259259
],
@@ -393,7 +393,7 @@ public function keypairPublicKey(): array
393393
public function keypairName(): array
394394
{
395395
return [
396-
'location' => self::URL,
396+
'location' => self::URL,
397397
];
398398
}
399399

@@ -449,7 +449,7 @@ public function attachmentId(): array
449449
public function consoleType(): array
450450
{
451451
return [
452-
'type' => self::STRING_TYPE,
452+
'type' => self::STRING_TYPE,
453453
'location' => self::JSON,
454454
'required' => true
455455
];
@@ -458,15 +458,90 @@ public function consoleType(): array
458458
protected function quotaSetLimit($sentAs, $description): array
459459
{
460460
return [
461-
'type' => self::INT_TYPE,
462-
'location' => self::JSON,
463-
'sentAs' => $sentAs,
461+
'type' => self::INT_TYPE,
462+
'location' => self::JSON,
463+
'sentAs' => $sentAs,
464464
'description' => $description
465465
];
466466
}
467467

468+
public function quotaSetLimitForce(): array
469+
{
470+
return [
471+
'type' => self::BOOLEAN_TYPE,
472+
'location' => self::JSON,
473+
'sentAs' => 'force',
474+
'description' => 'You can force the update even if the quota has already been used and the reserved quota exceeds the new quota'
475+
];
476+
}
477+
468478
public function quotaSetLimitInstances(): array
469479
{
470-
return $this->quotaSetLimit('instances', 'The number of allowed instance cores for each tenant.');
480+
return $this->quotaSetLimit('instances', 'The number of allowed instances for each tenant.');
481+
}
482+
483+
public function quotaSetLimitCores(): array
484+
{
485+
return $this->quotaSetLimit('cores', 'The number of allowed instance cores for each tenant.');
486+
}
487+
488+
public function quotaSetLimitFixedIps(): array
489+
{
490+
return $this->quotaSetLimit('fixed_ips', 'The number of allowed fixed IP addresses for each tenant. Must be equal to or greater than the number of allowed instances.');
491+
}
492+
493+
public function quotaSetLimitFloatingIps(): array
494+
{
495+
return $this->quotaSetLimit('floating_ips', 'The number of allowed floating IP addresses for each tenant.');
496+
}
497+
498+
public function quotaSetLimitInjectedFileContentBytes(): array
499+
{
500+
return $this->quotaSetLimit('injected_file_content_bytes', 'The number of allowed bytes of content for each injected file.');
501+
}
502+
503+
public function quotaSetLimitInjectedFilePathBytes(): array
504+
{
505+
return $this->quotaSetLimit('injected_file_path_bytes', 'The number of allowed bytes for each injected file path.');
506+
}
507+
508+
public function quotaSetLimitInjectedFiles(): array
509+
{
510+
return $this->quotaSetLimit('injected_files', 'The number of allowed injected files for each tenant.');
511+
}
512+
513+
public function quotaSetLimitKeyPairs(): array
514+
{
515+
return $this->quotaSetLimit('key_pairs', 'The number of allowed key pairs for each user.');
516+
}
517+
518+
public function quotaSetLimitMetadataItems(): array
519+
{
520+
return $this->quotaSetLimit('metadata_items', 'The number of allowed metadata items for each instance.');
521+
}
522+
523+
public function quotaSetLimitRam(): array
524+
{
525+
return $this->quotaSetLimit('ram', 'The amount of allowed instance RAM (in MB) for each tenant.');
526+
}
527+
528+
public function quotaSetLimitSecurityGroupRules(): array
529+
{
530+
return $this->quotaSetLimit('security_group_rules', 'The number of allowed rules for each security group.');
531+
}
532+
533+
public function quotaSetLimitSecurityGroups(): array
534+
{
535+
return $this->quotaSetLimit('security_groups', 'The number of allowed security groups for each tenant.');
536+
}
537+
538+
public function quotaSetLimitServerGroups(): array
539+
{
540+
return $this->quotaSetLimit('server_groups', 'The number of allowed server groups for each tenant.');
541+
}
542+
543+
public function quotaSetLimitServerGroupMembers(): array
544+
{
545+
return $this->quotaSetLimit('server_group_members', 'The number of allowed members for each server group.');
471546
}
472547
}

0 commit comments

Comments
 (0)