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

[FEATURE REQ] make costmanagement compatible with last sdk version. #8764

Closed
erzads opened this issue Mar 5, 2020 · 17 comments
Closed

[FEATURE REQ] make costmanagement compatible with last sdk version. #8764

erzads opened this issue Mar 5, 2020 · 17 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@erzads
Copy link

erzads commented Mar 5, 2020

Is your feature request related to a problem? Please describe.
I am using com.microsoft.azure/azure@1.31.1 and I need to fetch cost information.
I have been looking everywhere in the sdk until I found com.microsoft.azure.costmanagement.v2018_05_31/azure-mgmt-costmanagement@1.0.0-beta.
I tried using it but I get:
Caused by: java.lang.SecurityException: class "com.microsoft.azure.credentials.ApplicationTokenCredentials"'s signer information does not match signer information of other classes in the same package

Describe the solution you'd like
Could a compatible version be made?

Describe alternatives you've considered
Stop using de sdk and doing all by hand/rest.

Additional context
None

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x] Description Added
  • [ x] Expected solution specified
@joshfree joshfree added Cost Management customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. labels Mar 10, 2020
@yaohaizh
Copy link
Contributor

@ChenTanyi could you help publish the cost management to the latest runtime? Thanks. //cc @yungezz

@ChenTanyi
Copy link
Contributor

@erzads Do you use any client-runtime package lower than 1.7.0? I've tested with these two packages successfully. The test code is https://github.com/tanyi-test/azure-sdk-for-java-8764.

PS: but the request got 404 which makes it raise a null pointer exception.

@erzads
Copy link
Author

erzads commented Mar 11, 2020

@ChenTanyi I couldn't find instructions on why dependencies I should add. I am using maven and I just included the dependency com.microsoft.azure/azure@1.31.1
Then, when I couldn't find cost management, I added com.microsoft.azure.costmanagement.v2018_05_31/azure-mgmt-costmanagement@1.0.0-beta.

@ChenTanyi
Copy link
Contributor

@erzads No, you shouldn't add other package unless you know about it. You can see my test code, I just add these two package together, and they work fine. If you use any client-runtime package lower than 1.7.0, please remove them or upgrade to 1.7.*

@yaohaizh
Copy link
Contributor

@ChenTanyi cost management package is quite old and it's runtime need updated.

@ChenTanyi
Copy link
Contributor

@yaohaizh cost management doesn't include runtime-authentication for ApplicationTokenCredentials, so it work fine to use the credential in azure 1.31.1, we don't need to update every package runtime due to it.

@yaohaizh
Copy link
Contributor

Then, the costmanagement used the old codesign signature, thus we cannot have two different signature for runtime, it is not necessary depends on runtime-authentitcaion.

@ChenTanyi
Copy link
Contributor

The root case is that there is a lower version authentication being included in the project. I guess there is a dependency in @erzads project:

    <dependency>
      <groupId>com.microsoft.azure</groupId>
      <artifactId>azure-client-authentication</artifactId>
      <version>1.6.*</version>
    </dependency>

@erzads if there is a dependency like it, please remove it. Otherwise, please give me your dependency in pom.xml or dependency:tree.

Besides, I've publish com.microsoft.azure.costmanagement.v2018_05_31/azure-mgmt-costmanagement@1.0.0-beta-1 with latest dependency. You can try with it, but I don't think it works if you just change such dependency.

@yaohaizh
Copy link
Contributor

@erzads could you try the latest bits from @ChenTanyi to see whether this issue is fixed. Thanks.

@erzads
Copy link
Author

erzads commented Mar 19, 2020

Sorry for the delay. I ended up doing all by rest.
I added the new dependency and my app can now startup with no errors.

Please, could you point me to the documentation on how to use the cost management sdk?
I would rather use it but I have no idea how to.

@erzads
Copy link
Author

erzads commented Mar 19, 2020

I admit I am lost here, but I am trying to list each resource group cost:
costManagementManager.operations().listAsync().toBlocking().first()

I get JsonParseException the first 3 times, and then null pointer exception after that.

java.lang.NullPointerException
	at com.microsoft.azure.management.costmanagement.v2018_05_31.implementation.OperationsInner$4.call(OperationsInner.java:132)
	at com.microsoft.azure.management.costmanagement.v2018_05_31.implementation.OperationsInner$4.call(OperationsInner.java:129)
	at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:259)
	at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:511)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:466)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:244)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
	at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
	at retrofit2.adapter.rxjava.CallArbiter.deliverResponse(CallArbiter.java:120)
	at retrofit2.adapter.rxjava.CallArbiter.emitResponse(CallArbiter.java:102)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:46)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
	at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeFlattenIterable.call(OnSubscribeFlattenIterable.java:66)
	at rx.internal.operators.OnSubscribeFlattenIterable.call(OnSubscribeFlattenIterable.java:38)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.Observable.subscribe(Observable.java:10423)
	at rx.Observable.subscribe(Observable.java:10390)
	at rx.observables.BlockingObservable.forEach(BlockingObservable.java:111)

@ChenTanyi
Copy link
Contributor

The NPE usually is due to the response status code is 404. You can use the the following configure to check http request is OK or not.

CostManagementManager
    .configure()
    .withLogLevel(LogLevel.BODY_AND_HEADERS)
    .authenticate...

@ChenTanyi
Copy link
Contributor

After my quick test, it seems the service not supports this apiVersion.
URL: https://management.azure.com/providers/Microsoft.CostManagement/operations?api-version=2018-05-31
Response:

{
	"error": {
		"code": "InvalidResourceType",
		"message": "The resource type 'operations' could not be found in the namespace 'Microsoft.CostManagement' for api version '2018-05-31'. The supported api-versions are '2017-10-01-preview,2018-08-31,2019-01-01,2018-08-01-preview,2018-10-01,2019-10-01'."
	}
}

but actually the api was here: https://github.com/azure/azure-rest-api-specs/blob/1c3a60403422ca8c73df7eb7c65ae2a3c90bf152/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2018-05-31/costmanagement.json#L778

I'll add service attention for it and generate a new version SDK for test.

@ChenTanyi ChenTanyi added the Service Attention Workflow: This issue is responsible by Azure service team. label Mar 20, 2020
@ghost
Copy link

ghost commented Mar 20, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @mspremp, @ramaganesan-rg.

@ChenTanyi
Copy link
Contributor

@erzads And also, I've released costmanagement v2019_11_01, you can try it later, if there is still service error.

openapi-sdkautomation-test bot pushed a commit to openapi-env-test/azure-sdk-for-java that referenced this issue Mar 24, 2020
Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs into keyvault_multiapi_readme

* 'master' of https://github.com/Azure/azure-rest-api-specs: (101 commits)
  add cli.md for automation (Azure#8411)
  adjust assignment (Azure#8782)
  Remove Microsoft.Backup.Admin 2016-05-01 API version (Azure#8588)
  Updating global setting in PostgreSQL/MySQL readme file (Azure#8777)
  update package name and output folder in readme.typescript.md (Azure#8764)
  add package-2019-12 python define (Azure#8769)
  Fix Parameter Description for validate resource move (Azure#8524)
  Edit pass for GA swagger (Azure#8759)
  Update proxy.json (Azure#8596)
  Model enums that may change in the future as strings (Azure#8760)
  Add api-version 2019-11-01 for resources/subscriptions (Azure#8728)
  regenerated all-api-versions
  PrivateLinkResources for Microsoft.Automation (Azure#8369)
  add cli.md for serialconsole (Azure#8401)
  add cli.md for mariadb (Azure#8466)
  [Computer Vision] Create CV API v3.0-preview (Azure#7402)
  Publish Microsoft.ContainerService api-version 2020-03-01 (Azure#8756)
  Update swagger based on auto-gen process change. (Azure#8766)
  add assignment-bot config (Azure#8716)
  add tag package-2019-12 to batch (Azure#8751)
  ...
openapi-sdkautomation-test bot pushed a commit to openapi-env-test/azure-sdk-for-java that referenced this issue Mar 24, 2020
Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs into keyvault_multiapi_readme

* 'master' of https://github.com/Azure/azure-rest-api-specs: (101 commits)
  add cli.md for automation (Azure#8411)
  adjust assignment (Azure#8782)
  Remove Microsoft.Backup.Admin 2016-05-01 API version (Azure#8588)
  Updating global setting in PostgreSQL/MySQL readme file (Azure#8777)
  update package name and output folder in readme.typescript.md (Azure#8764)
  add package-2019-12 python define (Azure#8769)
  Fix Parameter Description for validate resource move (Azure#8524)
  Edit pass for GA swagger (Azure#8759)
  Update proxy.json (Azure#8596)
  Model enums that may change in the future as strings (Azure#8760)
  Add api-version 2019-11-01 for resources/subscriptions (Azure#8728)
  regenerated all-api-versions
  PrivateLinkResources for Microsoft.Automation (Azure#8369)
  add cli.md for serialconsole (Azure#8401)
  add cli.md for mariadb (Azure#8466)
  [Computer Vision] Create CV API v3.0-preview (Azure#7402)
  Publish Microsoft.ContainerService api-version 2020-03-01 (Azure#8756)
  Update swagger based on auto-gen process change. (Azure#8766)
  add assignment-bot config (Azure#8716)
  add tag package-2019-12 to batch (Azure#8751)
  ...
openapi-sdkautomation-test bot pushed a commit to openapi-env-test/azure-sdk-for-java that referenced this issue Mar 24, 2020
Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs into keyvault_multiapi_readme

* 'master' of https://github.com/Azure/azure-rest-api-specs: (101 commits)
  add cli.md for automation (Azure#8411)
  adjust assignment (Azure#8782)
  Remove Microsoft.Backup.Admin 2016-05-01 API version (Azure#8588)
  Updating global setting in PostgreSQL/MySQL readme file (Azure#8777)
  update package name and output folder in readme.typescript.md (Azure#8764)
  add package-2019-12 python define (Azure#8769)
  Fix Parameter Description for validate resource move (Azure#8524)
  Edit pass for GA swagger (Azure#8759)
  Update proxy.json (Azure#8596)
  Model enums that may change in the future as strings (Azure#8760)
  Add api-version 2019-11-01 for resources/subscriptions (Azure#8728)
  regenerated all-api-versions
  PrivateLinkResources for Microsoft.Automation (Azure#8369)
  add cli.md for serialconsole (Azure#8401)
  add cli.md for mariadb (Azure#8466)
  [Computer Vision] Create CV API v3.0-preview (Azure#7402)
  Publish Microsoft.ContainerService api-version 2020-03-01 (Azure#8756)
  Update swagger based on auto-gen process change. (Azure#8766)
  add assignment-bot config (Azure#8716)
  add tag package-2019-12 to batch (Azure#8751)
  ...
@jochav
Copy link

jochav commented Dec 4, 2020

@ChenTanyi, @erzads. Is this still an issue? can this item be closed?

@ramaganesan-rg
Copy link
Member

Hello @erzads - apologies for the delay in our response. At this point, we are not sure if the issue still persists at your end. we are archiving the request.
Please feel free to reopen this issue if you are blocked and need our team assistance.
Thank you for reaching out to us.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants