1. Packages
  2. Cyral Provider
  3. API Docs
  4. RepositoryAccessGateway
cyral 4.16.3 published on Monday, Apr 14, 2025 by cyralinc

cyral.RepositoryAccessGateway

Explore with Pulumi AI

cyral logo
cyral 4.16.3 published on Monday, Apr 14, 2025 by cyralinc

    # cyral.RepositoryAccessGateway (Resource)

    Manages the sidecar and binding set as the access gateway for cyral_repositories.

    Import ID syntax is {repository_id}.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cyral from "@pulumi/cyral";
    
    // Create a repository
    const repo = new cyral.Repository("repo", {
        type: "mongodb",
        repoNodes: [{
            host: "mongodb.cyral.com",
            port: 27017,
        }],
    });
    // Create a sidecar
    const sidecar = new cyral.Sidecar("sidecar", {deploymentMethod: "docker"});
    // Create a listener for the sidecar
    const listener = new cyral.SidecarListener("listener", {
        sidecarId: sidecar.id,
        repoTypes: ["mongodb"],
        networkAddress: {
            port: 27017,
        },
    });
    // Bind the sidecar listener to the repository
    const binding = new cyral.RepositoryBinding("binding", {
        sidecarId: sidecar.id,
        repositoryId: repo.id,
        enabled: true,
        listenerBindings: [{
            listenerId: listener.listenerId,
            nodeIndex: 0,
        }],
    });
    // Set the sidecar and binding as the access gateway
    // for the repository.
    const accessGateway = new cyral.RepositoryAccessGateway("accessGateway", {
        repositoryId: repo.id,
        sidecarId: sidecar.id,
        bindingId: binding.bindingId,
    });
    
    import pulumi
    import pulumi_cyral as cyral
    
    # Create a repository
    repo = cyral.Repository("repo",
        type="mongodb",
        repo_nodes=[{
            "host": "mongodb.cyral.com",
            "port": 27017,
        }])
    # Create a sidecar
    sidecar = cyral.Sidecar("sidecar", deployment_method="docker")
    # Create a listener for the sidecar
    listener = cyral.SidecarListener("listener",
        sidecar_id=sidecar.id,
        repo_types=["mongodb"],
        network_address={
            "port": 27017,
        })
    # Bind the sidecar listener to the repository
    binding = cyral.RepositoryBinding("binding",
        sidecar_id=sidecar.id,
        repository_id=repo.id,
        enabled=True,
        listener_bindings=[{
            "listener_id": listener.listener_id,
            "node_index": 0,
        }])
    # Set the sidecar and binding as the access gateway
    # for the repository.
    access_gateway = cyral.RepositoryAccessGateway("accessGateway",
        repository_id=repo.id,
        sidecar_id=sidecar.id,
        binding_id=binding.binding_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cyral/v4/cyral"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a repository
    		repo, err := cyral.NewRepository(ctx, "repo", &cyral.RepositoryArgs{
    			Type: pulumi.String("mongodb"),
    			RepoNodes: cyral.RepositoryRepoNodeArray{
    				&cyral.RepositoryRepoNodeArgs{
    					Host: pulumi.String("mongodb.cyral.com"),
    					Port: pulumi.Float64(27017),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Create a sidecar
    		sidecar, err := cyral.NewSidecar(ctx, "sidecar", &cyral.SidecarArgs{
    			DeploymentMethod: pulumi.String("docker"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create a listener for the sidecar
    		listener, err := cyral.NewSidecarListener(ctx, "listener", &cyral.SidecarListenerArgs{
    			SidecarId: sidecar.ID(),
    			RepoTypes: pulumi.StringArray{
    				pulumi.String("mongodb"),
    			},
    			NetworkAddress: &cyral.SidecarListenerNetworkAddressArgs{
    				Port: pulumi.Float64(27017),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Bind the sidecar listener to the repository
    		binding, err := cyral.NewRepositoryBinding(ctx, "binding", &cyral.RepositoryBindingArgs{
    			SidecarId:    sidecar.ID(),
    			RepositoryId: repo.ID(),
    			Enabled:      pulumi.Bool(true),
    			ListenerBindings: cyral.RepositoryBindingListenerBindingArray{
    				&cyral.RepositoryBindingListenerBindingArgs{
    					ListenerId: listener.ListenerId,
    					NodeIndex:  pulumi.Float64(0),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Set the sidecar and binding as the access gateway
    		// for the repository.
    		_, err = cyral.NewRepositoryAccessGateway(ctx, "accessGateway", &cyral.RepositoryAccessGatewayArgs{
    			RepositoryId: repo.ID(),
    			SidecarId:    sidecar.ID(),
    			BindingId:    binding.BindingId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cyral = Pulumi.Cyral;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a repository
        var repo = new Cyral.Repository("repo", new()
        {
            Type = "mongodb",
            RepoNodes = new[]
            {
                new Cyral.Inputs.RepositoryRepoNodeArgs
                {
                    Host = "mongodb.cyral.com",
                    Port = 27017,
                },
            },
        });
    
        // Create a sidecar
        var sidecar = new Cyral.Sidecar("sidecar", new()
        {
            DeploymentMethod = "docker",
        });
    
        // Create a listener for the sidecar
        var listener = new Cyral.SidecarListener("listener", new()
        {
            SidecarId = sidecar.Id,
            RepoTypes = new[]
            {
                "mongodb",
            },
            NetworkAddress = new Cyral.Inputs.SidecarListenerNetworkAddressArgs
            {
                Port = 27017,
            },
        });
    
        // Bind the sidecar listener to the repository
        var binding = new Cyral.RepositoryBinding("binding", new()
        {
            SidecarId = sidecar.Id,
            RepositoryId = repo.Id,
            Enabled = true,
            ListenerBindings = new[]
            {
                new Cyral.Inputs.RepositoryBindingListenerBindingArgs
                {
                    ListenerId = listener.ListenerId,
                    NodeIndex = 0,
                },
            },
        });
    
        // Set the sidecar and binding as the access gateway
        // for the repository.
        var accessGateway = new Cyral.RepositoryAccessGateway("accessGateway", new()
        {
            RepositoryId = repo.Id,
            SidecarId = sidecar.Id,
            BindingId = binding.BindingId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cyral.Repository;
    import com.pulumi.cyral.RepositoryArgs;
    import com.pulumi.cyral.inputs.RepositoryRepoNodeArgs;
    import com.pulumi.cyral.Sidecar;
    import com.pulumi.cyral.SidecarArgs;
    import com.pulumi.cyral.SidecarListener;
    import com.pulumi.cyral.SidecarListenerArgs;
    import com.pulumi.cyral.inputs.SidecarListenerNetworkAddressArgs;
    import com.pulumi.cyral.RepositoryBinding;
    import com.pulumi.cyral.RepositoryBindingArgs;
    import com.pulumi.cyral.inputs.RepositoryBindingListenerBindingArgs;
    import com.pulumi.cyral.RepositoryAccessGateway;
    import com.pulumi.cyral.RepositoryAccessGatewayArgs;
    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) {
            // Create a repository
            var repo = new Repository("repo", RepositoryArgs.builder()
                .type("mongodb")
                .repoNodes(RepositoryRepoNodeArgs.builder()
                    .host("mongodb.cyral.com")
                    .port(27017)
                    .build())
                .build());
    
            // Create a sidecar
            var sidecar = new Sidecar("sidecar", SidecarArgs.builder()
                .deploymentMethod("docker")
                .build());
    
            // Create a listener for the sidecar
            var listener = new SidecarListener("listener", SidecarListenerArgs.builder()
                .sidecarId(sidecar.id())
                .repoTypes("mongodb")
                .networkAddress(SidecarListenerNetworkAddressArgs.builder()
                    .port(27017)
                    .build())
                .build());
    
            // Bind the sidecar listener to the repository
            var binding = new RepositoryBinding("binding", RepositoryBindingArgs.builder()
                .sidecarId(sidecar.id())
                .repositoryId(repo.id())
                .enabled(true)
                .listenerBindings(RepositoryBindingListenerBindingArgs.builder()
                    .listenerId(listener.listenerId())
                    .nodeIndex(0)
                    .build())
                .build());
    
            // Set the sidecar and binding as the access gateway
            // for the repository.
            var accessGateway = new RepositoryAccessGateway("accessGateway", RepositoryAccessGatewayArgs.builder()
                .repositoryId(repo.id())
                .sidecarId(sidecar.id())
                .bindingId(binding.bindingId())
                .build());
    
        }
    }
    
    resources:
      # Create a repository
      repo:
        type: cyral:Repository
        properties:
          type: mongodb
          repoNodes:
            - host: mongodb.cyral.com
              port: 27017
      # Create a sidecar
      sidecar:
        type: cyral:Sidecar
        properties:
          deploymentMethod: docker
      # Create a listener for the sidecar
      listener:
        type: cyral:SidecarListener
        properties:
          sidecarId: ${sidecar.id}
          repoTypes:
            - mongodb
          networkAddress:
            port: 27017
      # Bind the sidecar listener to the repository
      binding:
        type: cyral:RepositoryBinding
        properties:
          sidecarId: ${sidecar.id}
          repositoryId: ${repo.id}
          enabled: true
          listenerBindings:
            - listenerId: ${listener.listenerId}
              nodeIndex: 0
      # Set the sidecar and binding as the access gateway
      # for the repository.
      accessGateway:
        type: cyral:RepositoryAccessGateway
        properties:
          repositoryId: ${repo.id}
          sidecarId: ${sidecar.id}
          bindingId: ${binding.bindingId}
    

    Create RepositoryAccessGateway Resource

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

    Constructor syntax

    new RepositoryAccessGateway(name: string, args: RepositoryAccessGatewayArgs, opts?: CustomResourceOptions);
    @overload
    def RepositoryAccessGateway(resource_name: str,
                                args: RepositoryAccessGatewayArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def RepositoryAccessGateway(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                binding_id: Optional[str] = None,
                                repository_id: Optional[str] = None,
                                sidecar_id: Optional[str] = None,
                                repository_access_gateway_id: Optional[str] = None)
    func NewRepositoryAccessGateway(ctx *Context, name string, args RepositoryAccessGatewayArgs, opts ...ResourceOption) (*RepositoryAccessGateway, error)
    public RepositoryAccessGateway(string name, RepositoryAccessGatewayArgs args, CustomResourceOptions? opts = null)
    public RepositoryAccessGateway(String name, RepositoryAccessGatewayArgs args)
    public RepositoryAccessGateway(String name, RepositoryAccessGatewayArgs args, CustomResourceOptions options)
    
    type: cyral:RepositoryAccessGateway
    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 RepositoryAccessGatewayArgs
    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 RepositoryAccessGatewayArgs
    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 RepositoryAccessGatewayArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RepositoryAccessGatewayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RepositoryAccessGatewayArgs
    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 repositoryAccessGatewayResource = new Cyral.RepositoryAccessGateway("repositoryAccessGatewayResource", new()
    {
        BindingId = "string",
        RepositoryId = "string",
        SidecarId = "string",
        RepositoryAccessGatewayId = "string",
    });
    
    example, err := cyral.NewRepositoryAccessGateway(ctx, "repositoryAccessGatewayResource", &cyral.RepositoryAccessGatewayArgs{
    	BindingId:                 pulumi.String("string"),
    	RepositoryId:              pulumi.String("string"),
    	SidecarId:                 pulumi.String("string"),
    	RepositoryAccessGatewayId: pulumi.String("string"),
    })
    
    var repositoryAccessGatewayResource = new RepositoryAccessGateway("repositoryAccessGatewayResource", RepositoryAccessGatewayArgs.builder()
        .bindingId("string")
        .repositoryId("string")
        .sidecarId("string")
        .repositoryAccessGatewayId("string")
        .build());
    
    repository_access_gateway_resource = cyral.RepositoryAccessGateway("repositoryAccessGatewayResource",
        binding_id="string",
        repository_id="string",
        sidecar_id="string",
        repository_access_gateway_id="string")
    
    const repositoryAccessGatewayResource = new cyral.RepositoryAccessGateway("repositoryAccessGatewayResource", {
        bindingId: "string",
        repositoryId: "string",
        sidecarId: "string",
        repositoryAccessGatewayId: "string",
    });
    
    type: cyral:RepositoryAccessGateway
    properties:
        bindingId: string
        repositoryAccessGatewayId: string
        repositoryId: string
        sidecarId: string
    

    RepositoryAccessGateway 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 RepositoryAccessGateway resource accepts the following input properties:

    BindingId string
    RepositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    SidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    RepositoryAccessGatewayId string
    The ID of this resource.
    BindingId string
    RepositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    SidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    RepositoryAccessGatewayId string
    The ID of this resource.
    bindingId String
    repositoryId String
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId String
    ID of the sidecar that will be set as the access gateway for the given repository.
    repositoryAccessGatewayId String
    The ID of this resource.
    bindingId string
    repositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    repositoryAccessGatewayId string
    The ID of this resource.
    binding_id str
    repository_id str
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecar_id str
    ID of the sidecar that will be set as the access gateway for the given repository.
    repository_access_gateway_id str
    The ID of this resource.
    bindingId String
    repositoryId String
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId String
    ID of the sidecar that will be set as the access gateway for the given repository.
    repositoryAccessGatewayId String
    The ID of this resource.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing RepositoryAccessGateway Resource

    Get an existing RepositoryAccessGateway 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?: RepositoryAccessGatewayState, opts?: CustomResourceOptions): RepositoryAccessGateway
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            binding_id: Optional[str] = None,
            repository_access_gateway_id: Optional[str] = None,
            repository_id: Optional[str] = None,
            sidecar_id: Optional[str] = None) -> RepositoryAccessGateway
    func GetRepositoryAccessGateway(ctx *Context, name string, id IDInput, state *RepositoryAccessGatewayState, opts ...ResourceOption) (*RepositoryAccessGateway, error)
    public static RepositoryAccessGateway Get(string name, Input<string> id, RepositoryAccessGatewayState? state, CustomResourceOptions? opts = null)
    public static RepositoryAccessGateway get(String name, Output<String> id, RepositoryAccessGatewayState state, CustomResourceOptions options)
    resources:  _:    type: cyral:RepositoryAccessGateway    get:      id: ${id}
    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:
    BindingId string
    RepositoryAccessGatewayId string
    The ID of this resource.
    RepositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    SidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    BindingId string
    RepositoryAccessGatewayId string
    The ID of this resource.
    RepositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    SidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    bindingId String
    repositoryAccessGatewayId String
    The ID of this resource.
    repositoryId String
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId String
    ID of the sidecar that will be set as the access gateway for the given repository.
    bindingId string
    repositoryAccessGatewayId string
    The ID of this resource.
    repositoryId string
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId string
    ID of the sidecar that will be set as the access gateway for the given repository.
    binding_id str
    repository_access_gateway_id str
    The ID of this resource.
    repository_id str
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecar_id str
    ID of the sidecar that will be set as the access gateway for the given repository.
    bindingId String
    repositoryAccessGatewayId String
    The ID of this resource.
    repositoryId String
    ID of the repository the access gateway is associated with. This is also the import ID for this resource.
    sidecarId String
    ID of the sidecar that will be set as the access gateway for the given repository.

    Package Details

    Repository
    cyral cyralinc/terraform-provider-cyral
    License
    Notes
    This Pulumi package is based on the cyral Terraform Provider.
    cyral logo
    cyral 4.16.3 published on Monday, Apr 14, 2025 by cyralinc