Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The API ListInstancesof ComputeClient does not return any value for the attribute PlatformConfig #474

Open
ParthaI opened this issue Jan 25, 2024 · 10 comments

Comments

@ParthaI
Copy link

ParthaI commented Jan 25, 2024

Dear Team,

We are currently utilizing the ListInstances API from the github.com/oracle/oci-go-sdk/v65/core Go Package to list instances in our environment. Our requirement includes retrieving PlatformConfig details provided by this API. However, we consistently receive a null value for the PlatformConfig attribute.

Could you kindly advise if there might be an error in our approach? Additionally, are there any alternative packages or APIs recommended for obtaining the PlatformConfig values for instances?

Thank you!

@jyotisaini
Copy link

Thanks for reporting this, @ParthaI . Its possible that service itself is returning the null for PlatformConfig. Can you try to use other client tool for eg. OCI CLI and see if you are getting the same response ? This would help us figure out if the issue is with the SDK while marshalling/unmarshalling the response or with the compute service.

@ParthaI
Copy link
Author

ParthaI commented Jan 26, 2024

Thank you, @jyotisaini, for your prompt response. I attempted using the OCI CLI command oci compute instance list --compartment-id <compartment id>, but I noticed that the Platform config value is consistently returned as null.

      "lifecycle-state": "STOPPED",
      "metadata": {},
      "platform-config": null,
      "preemptible-instance-config": null,
      "region": "ap-mumbai-1",
      "shape": "VM.Standard.E4.Flex",

Are there any alternative packages or APIs recommended for obtaining the PlatformConfig values for instances?

@JoshuaWR
Copy link
Member

JoshuaWR commented Feb 9, 2024

Hi @ParthaI, looks like any API that returns an Instance struct as one of it's properties has the possibility of returning platform-config. i.e. getInstance or instanceActionResponse. It doesn't look like this parameter exists outside the Instance struct, though.

@ParthaI
Copy link
Author

ParthaI commented Apr 1, 2024

Hey, @JoshuaWR, sorry for the late replay, getInstance or instanceActionResponse returns the Instance struct within the response and the PlatformConfig is the part of the Instance structure.

Do you have any idea why the value is always null?

@lacioffi-tenchi
Copy link

lacioffi-tenchi commented Apr 18, 2024

Hello, sorry to butt into this ticket but I'm having the same issue, albeit in a different manner.

The listInstances API does not return platformConfig:
https://iaas.[REGION].oraclecloud.com/20160918/instances/ ->
"platformConfig": null

but OCI CLI instance get does return it:
oci compute instance get --instance-id [ID] ->

 "platform-config": {
      "is-measured-boot-enabled": true,
      "is-memory-encryption-enabled": false,
      "is-secure-boot-enabled": true,
      "is-symmetric-multi-threading-enabled": true,
      "is-trusted-platform-module-enabled": true,
      "type": "AMD_VM"
    },

I haven't tried explictly calling the GetInstance method instead of the ListInstances method on the API, but the documentation says they should return the same thing. Looks like a bug on the API 🤔

https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/ListInstances
https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/GetInstance

@ParthaI
Copy link
Author

ParthaI commented Apr 19, 2024

@jyotisaini, Thanks For your response.
Could you please try making GetInstance API call explicitly or could you please confirm which version of SDK does return the platform-config data(The SDK version v65.28.0 did not help to get the platform-config data)?

FYI, If you would like to give it a try for GetInstance API call, the following Go code may help you debug the error.

// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/core"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleGetInstance() {
	// Create a default authentication provider that uses the DEFAULT
	// profile in the configuration file.
	// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
	client, err := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := core.GetInstanceRequest{InstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value")}

	// Send the request using the service client
	resp, err := client.GetInstance(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}

Thanks!

@lacioffi-tenchi
Copy link

@ParthaI which permissions are you granting to the account running the command?
I've found out that the INSPECT permission allows you to retrieve some data from the instances, but for others (such as PlatformConfig), it returns a null value. Updating this to a READ instances permission made the PlatformConfig be returned succesfully!

@ParthaI
Copy link
Author

ParthaI commented Apr 19, 2024

@lacioffi-tenchi, I have admin privilege but still, I am not able to get the PlatformConfig details. Do I need this particular permission(READ instances) to get this value? Do we have any document reference for it?

@lacioffi-tenchi
Copy link

lacioffi-tenchi commented Apr 19, 2024

@ParthaI

Do I need this particular permission(READ instances) to get this value?

Not sure. I didn't try it with admin privileges. Also note I'm using the API directly, I'm not using this SDK. I'm just posting here because the issues seem very related.

Do we have any document reference for it?

No idea mate 😆

@ParthaI
Copy link
Author

ParthaI commented Apr 22, 2024

Thank you, @lacioffi-tenchi, for the information. Based on what I understand, having Admin privileges should suffice to access the details. Regarding our earlier discussion, could this serve as a solution for the GetInstance function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants