Skip to Main Content

Cloud Platform

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oci-sdk osubbillingschedule getting NotAuthorizedOrNotFound on Methods

User_3ZU5SJun 2 2022

I'm new with Oracle and their tools, I have a problem using their SDK.
My target is to get my spendings in his cloud.
Stack:
-NodeJS
-Typescript
CheckList:
[X] Defined compartment (billingTesting)
[X] Defined Virtual Cloud Networks in billingTesting Compartment
[X] Defined policies for my users  in billingTesting Compartment
allow any-user to manage all-resources in compartment billingTesting where request.instance.compartment.id = 'ocid1.compartment.oc1..aaaaaaaakjzjuthyjjloua4352ngahgstdp6f6tufcwe5xclikapcgccgeja'allow any-user to manage all-resources in compartment billingTesting where request.instance.compartment.id = 'ocid1.compartment.oc1..aaaaaaaakjzjuthyjjloua4352ngahgstdp6f6tufcwe5xclikapcgccgeja'
Allow group 'testing-domain'/'All Domain Users' to manage accountmanagement-family in compartment billingTestingAllow group 'testing-domain'/'All Domain Users' to manage accountmanagement-family in compartment billingTesting
Allow group 'testing-domain'/'All Domain Users' to manage tickets in compartment billingTestingAllow group 'testing-domain'/'All Domain Users' to manage tickets in compartment billingTesting
Allow group 'testing-domain'/'All Domain Users' to manage usage-budgets in compartment billingTestingAllow group 'testing-domain'/'All Domain Users' to manage usage-budgets in compartment billingTesting
Allow group 'testing-domain'/'All Domain Users' to read usage-reports in compartment billingTesting
[X] Defined policies for my users  in billingTesting Compartment
[X] Instances in billingTesting Compartment to start being charged

[CODE]

async getSpendingsBySDK(_start: Date, _end: Date): Promise<any> {
try {
  const provider: common.ConfigFileAuthenticationDetailsProvider =
    new common.ConfigFileAuthenticationDetailsProvider(
      configurationFilePath,
      configProfile
    );

  const params: common.AuthParams = {
    authenticationDetailsProvider: provider,
  };

  const BillingInstance = new osubbillingschedule.BillingScheduleClient(
    params
  );

  const listBillingSchedulesRequest: osubbillingschedule.requests.ListBillingSchedulesRequest =
    {
      compartmentId:
        "ocid1.compartment.oc1..aaaaaaaaduyxkmce3acicjqxdfkzd6p3tjkbxrfgvqfatje3hilk3s3or7pa",
      subscriptionId:
        "ocid1.organizationssubscription.oc1.iad.amaaaaaaguhtzpaamwlys7uhxhy6pygazi67u565a7wccpmp2etplqg2dk2a",
    };
  try {
    await BillingInstance.listBillingSchedules(listBillingSchedulesRequest);
  } catch (e) {
    console.log("ERROR :", e);
  }
} catch (error) {
  console.log("listBillingSchedules Failed with error  " + error);
}

{
But still getting

statusCode: 404,
serviceCode: 'NotAuthorizedOrNotFound',
opcRequestId: 'F4655200D63E-11EC-BC89-1. DB8766D0/A00AF9733E440E947B5616BFB8FB0648/8145A8C6B430DBA4EE32B0284A4FD665'

}

I need a hand here, any help will be appreciated, thank's for your time reading my issue !

Comments
Post Details
Added on Jun 2 2022
0 comments
344 views