Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.68k stars 5.1k forks source link

graphrbac doesn't have signed-in use (me) operations #2647

Open marstr opened 6 years ago

marstr commented 6 years ago

This has been open for sometime as Azure/azure-sdk-for-go#698.

As written by @chessman:

Graph API has Signed-in user operations: https://msdn.microsoft.com/Library/Azure/Ad/Graph/api/signed-in-user-operations

I use a workaround now:

func Me(authorizer autorest.Authorizer) (graphrbac.User, error) {
  uclient := graphrbac.NewUsersClient("myorganization")
  uclient.Authorizer = authorizer

  req, _ := uclient.GetPreparer("")
  r := strings.NewReplacer("users", "me")
  req.URL.Path = r.Replace(req.URL.Path)

  resp, err := uclient.GetSender(req)
  if err != nil {
      return graphrbac.User{}, err
  }

  return uclient.GetResponder(resp)
}

The right fix to this would be to add operations in the Swagger under a separate path.

lyda commented 6 years ago

Is this being fixed?