Giter VIP home page Giter VIP logo

Comments (11)

ctaggart avatar ctaggart commented on August 20, 2024 3

Yes, but with an underscore please instead of a dash. The use statement will be use azure_core::TokenCredential whether the crate is named azure-core or azure_core and I prefer it to be consistent as well.

from azure-sdk-for-rust.

ctaggart avatar ctaggart commented on August 20, 2024 2

I think Python & C# provide good examples. In Python, you create a client with an implementation of azure.core.credentials.TokenCredential. An example is the StorageManagementClient:

StorageManagementClient(credential, subscription_id, api_version=None, base_url=None, profile=<KnownProfiles.default: <azure.profiles.DefaultProfile object>>, **kwargs)

Here are a couple of examples from the How to authenticate and authorize Python apps on Azure docs that show using azure.identity classes provided from https://pypi.org/project/azure-identity/ package:

from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()

from azure.identity import AzureCliCredential
credential = AzureCliCredential()

(implementation of AzureCliCredential)

C# has an Azure.Core.TokenCredential abstract class in Azure.Core package with lot of implementation from the Azure.Identity package:

    Azure.Identity.AuthorizationCodeCredential
    Azure.Identity.AzureCliCredential
    Azure.Identity.ChainedTokenCredential
    Azure.Identity.ClientCertificateCredential
    Azure.Identity.ClientSecretCredential
    Azure.Identity.DefaultAzureCredential
    Azure.Identity.DeviceCodeCredential
    Azure.Identity.EnvironmentCredential
    Azure.Identity.InteractiveBrowserCredential
    Azure.Identity.ManagedIdentityCredential
    Azure.Identity.SharedTokenCacheCredential
    Azure.Identity.UsernamePasswordCredential
    Azure.Identity.VisualStudioCodeCredential
    Azure.Identity.VisualStudioCredential

So, we probably want to have similar implementations in an azure_identity crate.

from azure-sdk-for-rust.

heaths avatar heaths commented on August 20, 2024

Yes, please use JS and C# naming conventions. Go is ramping back up, but seems to have had a lull when other languages were standardizing a set of cross-cutting guidelines. But the create name would still be something like azure-identity. Classes (structs) typically take the form of *Credential, like EnvironmentCredential.

from azure-sdk-for-rust.

heaths avatar heaths commented on August 20, 2024

In strongly-typed languages like C# and Java, we define the TokenCredential base class in Azure.Core (where we put all things of that nature, including pipelining code, which we'll want to consider here - at least for pub types/methods) because anyone can create one. In fact, we had a couple of our own libraries define their own, but recently consolidated them to AzureKeyCredential and added that to Azure.Core since they were all basically the same - just supply an "api-key" (or custom value name, if not "api-key"). But Azure.Identity is separate and not a direct dependency by design. At least in current implementations, it requires other libraries like MSAL or other platform-specific libraries we don't want to force customers into, especially when libraries like MSAL introduce all sorts of versioning issues.

from azure-sdk-for-rust.

ctaggart avatar ctaggart commented on August 20, 2024

A trait implementation must live in the same crate due to Rust's trait coherence and the orphan rule, so I'm struggling to figure out the right design for the dependencies in my head.

from azure-sdk-for-rust.

heaths avatar heaths commented on August 20, 2024

Can't we just define a trait like TokenCredential in azure-core and each struct implement that create in azure-identity? I don't see how that's any different than built-in (well, std) traits.

from azure-sdk-for-rust.

rylev avatar rylev commented on August 20, 2024

Yes, since presumably almost all usage of an Azure SDK will require usage of the sdk-core crate, we can put it in there.

from azure-sdk-for-rust.

ctaggart avatar ctaggart commented on August 20, 2024

azure_sdk_core azure_core seems like the right place to put the TokenCredential interface. However, that crates dependencies need to be trimmed. Or may be we should create a azure_services_core as well. I want to take a dependency on TokenCredential from the services.

from azure-sdk-for-rust.

rylev avatar rylev commented on August 20, 2024

I'd definitely love to take a look at the core crate and see how we can trim it down. Our old friend features might be able to help us out there.

from azure-sdk-for-rust.

heaths avatar heaths commented on August 20, 2024

The create should be "azure-core" to match all other languages' SDKs. We should be idiomatic and absolutely do what makes sense for Rust, but "module" names and, when appropriate, type/method names should be similar. See https://azure.github.io/azure-sdk/general_introduction.html#consistent. Is there some reason you don't like "azure-core"? The fact it's a client SDK should be obvious from other branding, such as crate descriptions, etc.

from azure-sdk-for-rust.

rylev avatar rylev commented on August 20, 2024

This can be closed as we have decided on azure-identity as the name.

from azure-sdk-for-rust.

Related Issues (20)

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.