oci-go-sdk icon indicating copy to clipboard operation
oci-go-sdk copied to clipboard

Unable to listing out Autonomous Exadata Infrastructure resources

Open ParthaI opened this issue 3 years ago • 5 comments

Hi Team, We are using the List API for listing out the available Autonomous Exadata Infrastructure resources, the API does not return any data or error, even if the resources are available in console.

We would like to list the available resources in the console.

Thanks!

ParthaI avatar May 26 '22 13:05 ParthaI

@ParthaI Could you share your code snippet on how you're using this List API? Thanks! Looks like you're also unable to list resources using CLI, this is probably because:

  1. you're using the config file which does not match the account you use in the console and is missing permissions to access those resources
  2. the region you're accessing is not having the resources, please check which region you're targeting.

ZiyaoQiao avatar May 26 '22 17:05 ZiyaoQiao

Hi, @ZiyaoQiao Thanks for the quick reply.

  1. I don't know the API behavior or how it behaves, It does not throw any AccessDenied error while making CLI calls or Go API calls. I used the same User API keys as I am accessing the console. Using same access I am able to see the resources available in the console.
  2. I had resources in ap-hyderabad-1 region though it is costly resources I deleted those.
  3. Do I need any other grants for making CLI call?.

ParthaI avatar May 27 '22 13:05 ParthaI

Hello @ZiyaoQiao, any update on this issue?

ParthaI avatar Jun 01 '22 05:06 ParthaI

@ParthaI as requested by @ZiyaoQiao , can you please share a code snippet which reproduces the issue?

Some other questions:

  • Are you able to list other OCI resources from the same box, for the same region, and using the same credentials? What about for a different region?
  • Are you able to list other OCI Database service resources from the same box, for the same region, and using the same credentials? What about for a different region?

jodoglevy avatar Jun 07 '22 00:06 jodoglevy

Hi @jodoglevy. Hope you are doing well!

  • Yes, I am able to list other OCI resources from the same box, for the same region, and using the same credentials, for other regions I am getting empty results if there are no resources available in the mentioned region. If I don't have appropriate grants then I am getting the AccessDenied/Forbidden error fo the resources.
  • Yes, I am able to list other OCI Database service resources from the same box, for the same region, and using the same credentials.For other regions I am getting the empty results and same error as mentioned above.

Below is the sample code I am using to listing out ADB EXA resources

func listAutonomousExadatainfrastructure(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
	logger := plugin.Logger(ctx)
	region := plugin.GetMatrixItem(ctx)[matrixKeyRegion].(string)
	compartment := plugin.GetMatrixItem(ctx)[matrixKeyCompartment].(string)
	logger.Debug("listAutonomousContainerDatabases", "Compartment", compartment, "OCI_REGION", region)

	equalQuals := d.KeyColumnQuals
	// quals := d.Quals

	// Return nil, if given compartment_id doesn't match
	if equalQuals["compartment_id"] != nil && compartment != equalQuals["compartment_id"].GetStringValue() {
		return nil, nil
	}

	// Create Session
	session, err := databaseService(ctx, d, region)
	if err != nil {
		return nil, err
	}

	// Build request parameters
	// request := buildAutonomousContainerDatabaseFilter(equalQuals, quals)
	request := &database.ListAutonomousExadataInfrastructuresRequest{}
	request.CompartmentId = types.String(compartment)
	request.Limit = types.Int(1000)
	request.RequestMetadata = common.RequestMetadata{
		RetryPolicy: getDefaultRetryPolicy(d.Connection),
	}

	limit := d.QueryContext.Limit
	if limit != nil {
		if *limit < int64(*request.Limit) {
			request.Limit = types.Int(int(*limit))
		}
	}

	pagesLeft := true
	for pagesLeft {
		response, err := session.DatabaseClient.ListAutonomousExadataInfrastructures(ctx, *request)
		plugin.Logger(ctx).Error("Response Length =========>>>>>>", len(response.Items))
		if err != nil {
			return nil, err
		}


		for _, container := range response.Items {
			d.StreamListItem(ctx, container)

			// Context can be cancelled due to manual cancellation or the limit has been hit
			if d.QueryStatus.RowsRemaining(ctx) == 0 {
				return nil, nil
			}
		}
		if response.OpcNextPage != nil {
			request.Page = response.OpcNextPage
		} else {
			pagesLeft = false
		}
	}

	return nil, err
}

Thanks!

ParthaI avatar Jun 07 '22 05:06 ParthaI

@ParthaI Autonomous Exadata Infrastructure has been migrated to 2 different resources - Cloud Exadata Infrastructure (CEI) and Cloud Autonomous VM Cluster (CAVM). This change was to decouple hardware (CEI) and VMs (CAVM) running on the hardware. With the split, we can enable users to create multiple clusters on the same hardware (multi-VM feature will be available soon).

The new resource hierarchy will be: CloudExadataInfrastructure -> CloudAutonomousVmCluster -> AutonomousContainerDatabase -> AutonomousDatabase

Please try to list CloudAutonomousVmClusters and you should see your resources.

dbaasdev avatar Nov 17 '22 16:11 dbaasdev

Hi @ParthaI , we will be closing this ticket as we haven't heard from you on the above suggestion. Please feel free to re-open the ticket if you still have issues.

Thanks.

KartikShrikantHegde avatar Mar 13 '23 18:03 KartikShrikantHegde