1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Limits
  5. getResourceAvailability
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

oci.Limits.getResourceAvailability

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

This data source provides details about a specific Resource Availability resource in Oracle Cloud Infrastructure Limits service.

For a given compartmentId, resource limit name, and scope, returns the following:

  • The number of available resources associated with the given limit.
  • The usage in the selected compartment for the given limit. If Subscription Id is provided, then usage for resource created in that subscription will be returned Note that not all resource limits support this API. If the value is not available, the API returns a 404 response.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testResourceAvailability = oci.Limits.getResourceAvailability({
    compartmentId: tenancyOcid,
    limitName: resourceAvailabilityLimitName,
    serviceName: testService.name,
    availabilityDomain: resourceAvailabilityAvailabilityDomain,
    subscriptionId: subscriptionOcid,
});
Copy
import pulumi
import pulumi_oci as oci

test_resource_availability = oci.Limits.get_resource_availability(compartment_id=tenancy_ocid,
    limit_name=resource_availability_limit_name,
    service_name=test_service["name"],
    availability_domain=resource_availability_availability_domain,
    subscription_id=subscription_ocid)
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/limits"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := limits.GetResourceAvailability(ctx, &limits.GetResourceAvailabilityArgs{
			CompartmentId:      tenancyOcid,
			LimitName:          resourceAvailabilityLimitName,
			ServiceName:        testService.Name,
			AvailabilityDomain: pulumi.StringRef(resourceAvailabilityAvailabilityDomain),
			SubscriptionId:     pulumi.StringRef(subscriptionOcid),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testResourceAvailability = Oci.Limits.GetResourceAvailability.Invoke(new()
    {
        CompartmentId = tenancyOcid,
        LimitName = resourceAvailabilityLimitName,
        ServiceName = testService.Name,
        AvailabilityDomain = resourceAvailabilityAvailabilityDomain,
        SubscriptionId = subscriptionOcid,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Limits.LimitsFunctions;
import com.pulumi.oci.Limits.inputs.GetResourceAvailabilityArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testResourceAvailability = LimitsFunctions.getResourceAvailability(GetResourceAvailabilityArgs.builder()
            .compartmentId(tenancyOcid)
            .limitName(resourceAvailabilityLimitName)
            .serviceName(testService.name())
            .availabilityDomain(resourceAvailabilityAvailabilityDomain)
            .subscriptionId(subscriptionOcid)
            .build());

    }
}
Copy
variables:
  testResourceAvailability:
    fn::invoke:
      function: oci:Limits:getResourceAvailability
      arguments:
        compartmentId: ${tenancyOcid}
        limitName: ${resourceAvailabilityLimitName}
        serviceName: ${testService.name}
        availabilityDomain: ${resourceAvailabilityAvailabilityDomain}
        subscriptionId: ${subscriptionOcid}
Copy

Using getResourceAvailability

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getResourceAvailability(args: GetResourceAvailabilityArgs, opts?: InvokeOptions): Promise<GetResourceAvailabilityResult>
function getResourceAvailabilityOutput(args: GetResourceAvailabilityOutputArgs, opts?: InvokeOptions): Output<GetResourceAvailabilityResult>
Copy
def get_resource_availability(availability_domain: Optional[str] = None,
                              compartment_id: Optional[str] = None,
                              limit_name: Optional[str] = None,
                              service_name: Optional[str] = None,
                              subscription_id: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetResourceAvailabilityResult
def get_resource_availability_output(availability_domain: Optional[pulumi.Input[str]] = None,
                              compartment_id: Optional[pulumi.Input[str]] = None,
                              limit_name: Optional[pulumi.Input[str]] = None,
                              service_name: Optional[pulumi.Input[str]] = None,
                              subscription_id: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetResourceAvailabilityResult]
Copy
func GetResourceAvailability(ctx *Context, args *GetResourceAvailabilityArgs, opts ...InvokeOption) (*GetResourceAvailabilityResult, error)
func GetResourceAvailabilityOutput(ctx *Context, args *GetResourceAvailabilityOutputArgs, opts ...InvokeOption) GetResourceAvailabilityResultOutput
Copy

> Note: This function is named GetResourceAvailability in the Go SDK.

public static class GetResourceAvailability 
{
    public static Task<GetResourceAvailabilityResult> InvokeAsync(GetResourceAvailabilityArgs args, InvokeOptions? opts = null)
    public static Output<GetResourceAvailabilityResult> Invoke(GetResourceAvailabilityInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetResourceAvailabilityResult> getResourceAvailability(GetResourceAvailabilityArgs args, InvokeOptions options)
public static Output<GetResourceAvailabilityResult> getResourceAvailability(GetResourceAvailabilityArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Limits/getResourceAvailability:getResourceAvailability
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
The OCID of the compartment for which data is being fetched.
LimitName This property is required. string
The limit name for which to fetch the data.
ServiceName This property is required. string
The service name of the target quota.
AvailabilityDomain string
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
SubscriptionId string
The OCID of the subscription assigned to tenant
CompartmentId This property is required. string
The OCID of the compartment for which data is being fetched.
LimitName This property is required. string
The limit name for which to fetch the data.
ServiceName This property is required. string
The service name of the target quota.
AvailabilityDomain string
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
SubscriptionId string
The OCID of the subscription assigned to tenant
compartmentId This property is required. String
The OCID of the compartment for which data is being fetched.
limitName This property is required. String
The limit name for which to fetch the data.
serviceName This property is required. String
The service name of the target quota.
availabilityDomain String
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
subscriptionId String
The OCID of the subscription assigned to tenant
compartmentId This property is required. string
The OCID of the compartment for which data is being fetched.
limitName This property is required. string
The limit name for which to fetch the data.
serviceName This property is required. string
The service name of the target quota.
availabilityDomain string
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
subscriptionId string
The OCID of the subscription assigned to tenant
compartment_id This property is required. str
The OCID of the compartment for which data is being fetched.
limit_name This property is required. str
The limit name for which to fetch the data.
service_name This property is required. str
The service name of the target quota.
availability_domain str
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
subscription_id str
The OCID of the subscription assigned to tenant
compartmentId This property is required. String
The OCID of the compartment for which data is being fetched.
limitName This property is required. String
The limit name for which to fetch the data.
serviceName This property is required. String
The service name of the target quota.
availabilityDomain String
This field is mandatory if the scopeType of the target resource limit is AD. Otherwise, this field should be omitted. If the above requirements are not met, the API returns a 400 - InvalidParameter response.
subscriptionId String
The OCID of the subscription assigned to tenant

getResourceAvailability Result

The following output properties are available:

Available string
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
CompartmentId string
EffectiveQuotaValue double
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
FractionalAvailability double
The most accurate count of available resources.
FractionalUsage double
The current most accurate usage in the given compartment.
Id string
The provider-assigned unique ID for this managed resource.
LimitName string
ServiceName string
Used string
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
AvailabilityDomain string
SubscriptionId string
Available string
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
CompartmentId string
EffectiveQuotaValue float64
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
FractionalAvailability float64
The most accurate count of available resources.
FractionalUsage float64
The current most accurate usage in the given compartment.
Id string
The provider-assigned unique ID for this managed resource.
LimitName string
ServiceName string
Used string
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
AvailabilityDomain string
SubscriptionId string
available String
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
compartmentId String
effectiveQuotaValue Double
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
fractionalAvailability Double
The most accurate count of available resources.
fractionalUsage Double
The current most accurate usage in the given compartment.
id String
The provider-assigned unique ID for this managed resource.
limitName String
serviceName String
used String
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
availabilityDomain String
subscriptionId String
available string
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
compartmentId string
effectiveQuotaValue number
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
fractionalAvailability number
The most accurate count of available resources.
fractionalUsage number
The current most accurate usage in the given compartment.
id string
The provider-assigned unique ID for this managed resource.
limitName string
serviceName string
used string
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
availabilityDomain string
subscriptionId string
available str
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
compartment_id str
effective_quota_value float
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
fractional_availability float
The most accurate count of available resources.
fractional_usage float
The current most accurate usage in the given compartment.
id str
The provider-assigned unique ID for this managed resource.
limit_name str
service_name str
used str
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
availability_domain str
subscription_id str
available String
The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.
compartmentId String
effectiveQuotaValue Number
The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.
fractionalAvailability Number
The most accurate count of available resources.
fractionalUsage Number
The current most accurate usage in the given compartment.
id String
The provider-assigned unique ID for this managed resource.
limitName String
serviceName String
used String
The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.
availabilityDomain String
subscriptionId String

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi