1. Packages
  2. OVH
  3. API Docs
  4. Me
  5. APIOAuth2Client
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

ovh.Me.APIOAuth2Client

Explore with Pulumi AI

ovh logo
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

    Creates an OAuth2 service account.

    Example Usage

    An OAuth2 client for an app hosted at my-app.com, that uses the authorization code flow to authenticate.

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    
    const myOauth2ClientAuthCode = new ovh.me.APIOAuth2Client("myOauth2ClientAuthCode", {
        callbackUrls: ["https://my-app.com/callback"],
        description: "An OAuth2 client using the authorization code flow for my-app.com",
        flow: "AUTHORIZATION_CODE",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    my_oauth2_client_auth_code = ovh.me.APIOAuth2Client("myOauth2ClientAuthCode",
        callback_urls=["https://my-app.com/callback"],
        description="An OAuth2 client using the authorization code flow for my-app.com",
        flow="AUTHORIZATION_CODE")
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/Me"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Me.NewAPIOAuth2Client(ctx, "myOauth2ClientAuthCode", &Me.APIOAuth2ClientArgs{
    			CallbackUrls: pulumi.StringArray{
    				pulumi.String("https://my-app.com/callback"),
    			},
    			Description: pulumi.String("An OAuth2 client using the authorization code flow for my-app.com"),
    			Flow:        pulumi.String("AUTHORIZATION_CODE"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var myOauth2ClientAuthCode = new Ovh.Me.APIOAuth2Client("myOauth2ClientAuthCode", new()
        {
            CallbackUrls = new[]
            {
                "https://my-app.com/callback",
            },
            Description = "An OAuth2 client using the authorization code flow for my-app.com",
            Flow = "AUTHORIZATION_CODE",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.Me.APIOAuth2Client;
    import com.pulumi.ovh.Me.APIOAuth2ClientArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var myOauth2ClientAuthCode = new APIOAuth2Client("myOauth2ClientAuthCode", APIOAuth2ClientArgs.builder()
                .callbackUrls("https://my-app.com/callback")
                .description("An OAuth2 client using the authorization code flow for my-app.com")
                .flow("AUTHORIZATION_CODE")
                .build());
    
        }
    }
    
    resources:
      myOauth2ClientAuthCode:
        type: ovh:Me:APIOAuth2Client
        properties:
          callbackUrls:
            - https://my-app.com/callback
          description: An OAuth2 client using the authorization code flow for my-app.com
          flow: AUTHORIZATION_CODE
    

    An OAuth2 client for an app hosted at my-app.com, that uses the client credentials flow to authenticate.

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    
    const myOauth2ClientClientCreds = new ovh.me.APIOAuth2Client("myOauth2ClientClientCreds", {
        description: "An OAuth2 client using the client credentials flow for my app",
        flow: "CLIENT_CREDENTIALS",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    my_oauth2_client_client_creds = ovh.me.APIOAuth2Client("myOauth2ClientClientCreds",
        description="An OAuth2 client using the client credentials flow for my app",
        flow="CLIENT_CREDENTIALS")
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/Me"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Me.NewAPIOAuth2Client(ctx, "myOauth2ClientClientCreds", &Me.APIOAuth2ClientArgs{
    			Description: pulumi.String("An OAuth2 client using the client credentials flow for my app"),
    			Flow:        pulumi.String("CLIENT_CREDENTIALS"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var myOauth2ClientClientCreds = new Ovh.Me.APIOAuth2Client("myOauth2ClientClientCreds", new()
        {
            Description = "An OAuth2 client using the client credentials flow for my app",
            Flow = "CLIENT_CREDENTIALS",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.Me.APIOAuth2Client;
    import com.pulumi.ovh.Me.APIOAuth2ClientArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var myOauth2ClientClientCreds = new APIOAuth2Client("myOauth2ClientClientCreds", APIOAuth2ClientArgs.builder()
                .description("An OAuth2 client using the client credentials flow for my app")
                .flow("CLIENT_CREDENTIALS")
                .build());
    
        }
    }
    
    resources:
      myOauth2ClientClientCreds:
        type: ovh:Me:APIOAuth2Client
        properties:
          description: An OAuth2 client using the client credentials flow for my app
          flow: CLIENT_CREDENTIALS
    

    Create APIOAuth2Client Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new APIOAuth2Client(name: string, args: APIOAuth2ClientArgs, opts?: CustomResourceOptions);
    @overload
    def APIOAuth2Client(resource_name: str,
                        args: APIOAuth2ClientArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def APIOAuth2Client(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        description: Optional[str] = None,
                        flow: Optional[str] = None,
                        callback_urls: Optional[Sequence[str]] = None,
                        name: Optional[str] = None)
    func NewAPIOAuth2Client(ctx *Context, name string, args APIOAuth2ClientArgs, opts ...ResourceOption) (*APIOAuth2Client, error)
    public APIOAuth2Client(string name, APIOAuth2ClientArgs args, CustomResourceOptions? opts = null)
    public APIOAuth2Client(String name, APIOAuth2ClientArgs args)
    public APIOAuth2Client(String name, APIOAuth2ClientArgs args, CustomResourceOptions options)
    
    type: ovh:Me:APIOAuth2Client
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args APIOAuth2ClientArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args APIOAuth2ClientArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args APIOAuth2ClientArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args APIOAuth2ClientArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args APIOAuth2ClientArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var apioauth2ClientResource = new Ovh.Me.APIOAuth2Client("apioauth2ClientResource", new()
    {
        Description = "string",
        Flow = "string",
        CallbackUrls = new[]
        {
            "string",
        },
        Name = "string",
    });
    
    example, err := Me.NewAPIOAuth2Client(ctx, "apioauth2ClientResource", &Me.APIOAuth2ClientArgs{
    	Description: pulumi.String("string"),
    	Flow:        pulumi.String("string"),
    	CallbackUrls: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Name: pulumi.String("string"),
    })
    
    var apioauth2ClientResource = new APIOAuth2Client("apioauth2ClientResource", APIOAuth2ClientArgs.builder()
        .description("string")
        .flow("string")
        .callbackUrls("string")
        .name("string")
        .build());
    
    apioauth2_client_resource = ovh.me.APIOAuth2Client("apioauth2ClientResource",
        description="string",
        flow="string",
        callback_urls=["string"],
        name="string")
    
    const apioauth2ClientResource = new ovh.me.APIOAuth2Client("apioauth2ClientResource", {
        description: "string",
        flow: "string",
        callbackUrls: ["string"],
        name: "string",
    });
    
    type: ovh:Me:APIOAuth2Client
    properties:
        callbackUrls:
            - string
        description: string
        flow: string
        name: string
    

    APIOAuth2Client Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The APIOAuth2Client resource accepts the following input properties:

    Description string
    OAuth2 client description.
    Flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    CallbackUrls List<string>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    Name string
    OAuth2 client name.
    Description string
    OAuth2 client description.
    Flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    CallbackUrls []string
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    Name string
    OAuth2 client name.
    description String
    OAuth2 client description.
    flow String
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    callbackUrls List<String>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    name String
    OAuth2 client name.
    description string
    OAuth2 client description.
    flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    callbackUrls string[]
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    name string
    OAuth2 client name.
    description str
    OAuth2 client description.
    flow str
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    callback_urls Sequence[str]
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    name str
    OAuth2 client name.
    description String
    OAuth2 client description.
    flow String
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    callbackUrls List<String>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    name String
    OAuth2 client name.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the APIOAuth2Client resource produces the following output properties:

    ClientId string
    Client ID of the created service account.
    ClientSecret string
    Client secret of the created service account.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identity string
    URN that will allow you to associate this oauth2 client with an access policy
    ClientId string
    Client ID of the created service account.
    ClientSecret string
    Client secret of the created service account.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identity string
    URN that will allow you to associate this oauth2 client with an access policy
    clientId String
    Client ID of the created service account.
    clientSecret String
    Client secret of the created service account.
    id String
    The provider-assigned unique ID for this managed resource.
    identity String
    URN that will allow you to associate this oauth2 client with an access policy
    clientId string
    Client ID of the created service account.
    clientSecret string
    Client secret of the created service account.
    id string
    The provider-assigned unique ID for this managed resource.
    identity string
    URN that will allow you to associate this oauth2 client with an access policy
    client_id str
    Client ID of the created service account.
    client_secret str
    Client secret of the created service account.
    id str
    The provider-assigned unique ID for this managed resource.
    identity str
    URN that will allow you to associate this oauth2 client with an access policy
    clientId String
    Client ID of the created service account.
    clientSecret String
    Client secret of the created service account.
    id String
    The provider-assigned unique ID for this managed resource.
    identity String
    URN that will allow you to associate this oauth2 client with an access policy

    Look up Existing APIOAuth2Client Resource

    Get an existing APIOAuth2Client resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: APIOAuth2ClientState, opts?: CustomResourceOptions): APIOAuth2Client
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            callback_urls: Optional[Sequence[str]] = None,
            client_id: Optional[str] = None,
            client_secret: Optional[str] = None,
            description: Optional[str] = None,
            flow: Optional[str] = None,
            identity: Optional[str] = None,
            name: Optional[str] = None) -> APIOAuth2Client
    func GetAPIOAuth2Client(ctx *Context, name string, id IDInput, state *APIOAuth2ClientState, opts ...ResourceOption) (*APIOAuth2Client, error)
    public static APIOAuth2Client Get(string name, Input<string> id, APIOAuth2ClientState? state, CustomResourceOptions? opts = null)
    public static APIOAuth2Client get(String name, Output<String> id, APIOAuth2ClientState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CallbackUrls List<string>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    ClientId string
    Client ID of the created service account.
    ClientSecret string
    Client secret of the created service account.
    Description string
    OAuth2 client description.
    Flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    Identity string
    URN that will allow you to associate this oauth2 client with an access policy
    Name string
    OAuth2 client name.
    CallbackUrls []string
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    ClientId string
    Client ID of the created service account.
    ClientSecret string
    Client secret of the created service account.
    Description string
    OAuth2 client description.
    Flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    Identity string
    URN that will allow you to associate this oauth2 client with an access policy
    Name string
    OAuth2 client name.
    callbackUrls List<String>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    clientId String
    Client ID of the created service account.
    clientSecret String
    Client secret of the created service account.
    description String
    OAuth2 client description.
    flow String
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    identity String
    URN that will allow you to associate this oauth2 client with an access policy
    name String
    OAuth2 client name.
    callbackUrls string[]
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    clientId string
    Client ID of the created service account.
    clientSecret string
    Client secret of the created service account.
    description string
    OAuth2 client description.
    flow string
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    identity string
    URN that will allow you to associate this oauth2 client with an access policy
    name string
    OAuth2 client name.
    callback_urls Sequence[str]
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    client_id str
    Client ID of the created service account.
    client_secret str
    Client secret of the created service account.
    description str
    OAuth2 client description.
    flow str
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    identity str
    URN that will allow you to associate this oauth2 client with an access policy
    name str
    OAuth2 client name.
    callbackUrls List<String>
    List of callback urls when configuring the AUTHORIZATION_CODE flow.
    clientId String
    Client ID of the created service account.
    clientSecret String
    Client secret of the created service account.
    description String
    OAuth2 client description.
    flow String
    The OAuth2 flow to use. AUTHORIZATION_CODE or CLIENT_CREDENTIALS are supported at the moment.
    identity String
    URN that will allow you to associate this oauth2 client with an access policy
    name String
    OAuth2 client name.

    Import

    OAuth2 clients can be imported using their client_id:

    bash

    $ pulumi import ovh:Me/aPIOAuth2Client:APIOAuth2Client my_oauth2_client client_id
    

    Because the client_secret is only available for resources created using terraform, OAuth2 clients can also be imported using a client_id and a client_secret with a pipe separator:

    bash

    $ pulumi import ovh:Me/aPIOAuth2Client:APIOAuth2Client my_oauth2_client 'client_id|client_secret'
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud