Giter Club home page Giter Club logo

commercial-marketplace-client-go's Introduction

Current status

This project is deprecated and not in active development.

Project

This library makes use of some "in-flight updates" to the Azure SDK for Go. The library relies on a specific library. This dependence will change in the future. The following information will allow you to get things working against the SaaS and Metering APIs.

With golang installed, run the following commands for your project in order to make sure your go.mod file is correct:

go mod init main
go get -d github.com/Azure/azure-sdk-for-go/sdk/[email protected]
go mod edit -require github.com/microsoft/commercial-marketplace-client-go/sdk/commercialmarketplace@latest
go mod tidy

Once that is done, you can run some code to see things in motion. For example, you can create a file called main.go and put the following contents:

package main

import (
	"context"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/microsoft/commercial-marketplace-client-go/sdk/commercialmarketplace"
	"os"
	"time"
)

var (
	clientCredentials, clientCredentialsErr = azidentity.NewClientSecretCredential(
		os.Getenv("AAD_TENANT_ID"),
		os.Getenv("AAD_APP_CLIENT_ID"),
		os.Getenv("AAD_APP_CLIENT_SECRET"),
		nil)
)

func main() {
	fmt.Print("Hello, World!")

	var connection = commercialmarketplace.NewDefaultConnection(clientCredentials, nil)

	client := commercialmarketplace.NewFulfillmentOperationsClient(connection)
	var subscriptionsLister = client.ListSubscriptions(nil)
	ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Minute)
	defer cancel()

	var hasNextPage = subscriptionsLister.NextPage(ctx)
	if !hasNextPage {
		fmt.Print("No pages to retrieve. Check credentials and make sure this ID has access to 1+ existing SaaS offers")
	}
	var response = subscriptionsLister.PageResponse()
	var subscriptions = response.Subscriptions
	if len(subscriptions) == 0 {
		fmt.Print("Expected 1 or more subscriptions to be returned.")
	} else {
		fmt.Print(*(subscriptions[0].Name))
	}
}

Then, using an identity you have already setup and published in a SaaS application registration in Partner Center Commercial Marketplace, set three environment variables (copying the Azure Active Directory tenant ID, Azure Active Directory application ID, and the secret for that identity). The environment variables are:

  • AAD_TENANT_ID: Azure Active Directory tenant ID
  • AAD_APP_CLIENT_ID: Azure Active Directory application ID
  • AAD_APP_CLIENT_SECRET: Secret associated with AAD_APP_CLIENT_ID

You can also use a certificate to authenticate with these APIs. That is not demonstrated here.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

commercial-marketplace-client-go's People

Contributors

dstarr avatar microsoftopensource avatar santhoshb-msft avatar scseely avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commercial-marketplace-client-go's Issues

Request to update azcore

Hi,

One of my services uses this marketplace client and service bus library. Recently new library for Azure Service Bus has been created ( https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/messaging/azservicebus ) and old one deprecated ( https://github.com/Azure/azure-service-bus-go ) and to avoid some issues related to that old implementation, we tried to move to new one but we are unable to compile our service as there is problem with azcore module, this marketplace client depends on azcore v0.16.2 and service bus on azcore v0.21.0, It seems that there was a lot of stuff removed between those versions and we are getting a lot of "undefined xyz". I'm unable to find any older version of azservicebus that would work with marketplace client.

../../../go/pkg/mod/github.com/microsoft/commercial-marketplace-client-go/sdk/[email protected]/connection.go:20:13: undefined: azcore.Transport
../../../go/pkg/mod/github.com/microsoft/commercial-marketplace-client-go/sdk/[email protected]/connection.go:22:8: undefined: azcore.RetryOptions
../../../go/pkg/mod/github.com/microsoft/commercial-marketplace-client-go/sdk/[email protected]/connection.go:24:12: undefined: azcore.TelemetryOptions
...

Can this library be updated to newer version of azcore?

Best Regards.

Regenerate the library to include P3Y term unit

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
There is a new term being introduced and this has been added to the openapi spec, now the library needs to be regenerated to include that.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.