{"modulePath":"github.com/simon-fredrich/function-gitlab-importer","version":"v0.3.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gitlabhandler\n\nPackage gitlabhandler provides helper types and methods for interacting with GitLab resources in the context of Crossplane compositions. It includes handlers for GitLab groups and projects, enabling extraction of key resource attributes and validation of resource existence.\n\nThe package offers:\n\n  - GroupHandler: Retrieves GitLab group properties such as namespace ID and path, and checks if a group already exists based on observed conditions.\n  - ProjectHandler: Retrieves GitLab project properties such as namespace ID and path, and checks if a project already exists based on observed conditions.\n\nThese handlers work with Crossplane's DesiredComposed and ObservedComposed resources, using the function-sdk-go for resource access and error handling.\n\nTypical usage:\n\n\tgroupHandler := \u0026gitlabhandler.GroupHandler{}\n\tnamespaceID, err := groupHandler.GetNamespaceID(desired)\n\tif err != nil {\n\t    // handle error\n\t}\n\n\texistsMsg, exists := groupHandler.CheckResourceExists(observed)\n\tif exists {\n\t    // resource already exists\n\t}\n\nThis package is intended for Crossplane Composition Function implementations that manage GitLab resources.\n\n## Types\n\n```go\ntype GroupHandler struct{}\n```\nGroupHandler provides helper methods for working with GitLab group resources in the context of Crossplane compositions. It enables extracting key attributes from desired resources and checking if a group already exists based on observed conditions.\n\nThe handler offers:\n\n  - GetNamespaceID: Retrieves the parent group ID (namespaceID) from the desired resource.\n  - GetPath: Retrieves the path of the GitLab group from the desired resource.\n  - CheckResourceExists: Determines if a GitLab group already exists by inspecting the \"Synced\" condition message for duplication errors.\n\nThis type is intended for use in Crossplane functions that manage GitLab groups.\n\n```go\nfunc (g *GroupHandler) CheckResourceExists(obs resource.ObservedComposed) (string, bool)\n```\nCheckResourceExists determines if a GitLab group already exists based on the observed resource. It inspects the \"Synced\" condition message and checks if it contains the phrase \"has already been taken\". Returns:\n\n  - The condition message.\n  - A boolean indicating whether the resource already exists.\n\n```go\nfunc (g *GroupHandler) GetNamespaceID(des *resource.DesiredComposed) (int, error)\n```\nGetNamespaceID retrieves the parent group ID (namespaceID) from the desired resource. It looks up the value at the path \"spec.forProvider.parentId\" in the resource. Returns:\n\n  - The namespace ID as an int if successful.\n  - An error if the value cannot be retrieved or converted.\n\n```go\nfunc (g *GroupHandler) GetPath(des *resource.DesiredComposed) (string, error)\n```\nGetPath retrieves the path of the GitLab group from the desired resource. It looks up the value at the path \"spec.forProvider.path\" in the resource. Returns:\n\n  - The path as a string if successful.\n  - An error if the value cannot be retrieved.\n\n```go\ntype ProjectHandler struct {\n\tName string\n}\n```\nProjectHandler provides helper methods for working with GitLab project resources in the context of Crossplane compositions. It enables extracting key attributes from desired resources and checking if a project already exists based on observed conditions.\n\nThe handler offers:\n\n  - GetNamespaceID: Retrieves the namespace ID of the GitLab project from the desired resource.\n  - GetPath: Retrieves the path of the GitLab project from the desired resource.\n  - CheckResourceExists: Determines if a GitLab project already exists by inspecting the \"Synced\" condition message for duplication errors.\n\nThis type is intended for use in Crossplane function implementations that manage GitLab projects.\n\n```go\nfunc (p *ProjectHandler) CheckResourceExists(obs resource.ObservedComposed) (string, bool)\n```\nCheckResourceExists determines if a GitLab project already exists based on the observed resource. It inspects the \"Synced\" condition message and checks if it contains the phrase \"has already been taken\". Returns:\n\n  - The condition message.\n  - A boolean indicating whether the resource already exists.\n\n```go\nfunc (p *ProjectHandler) GetNamespaceID(des *resource.DesiredComposed) (int, error)\n```\nGetNamespaceID retrieves the namespace ID of the GitLab project from the desired resource. It looks up the value at the path \"spec.forProvider.namespaceId\" in the resource. Returns:\n\n  - The namespace ID as an int if successful.\n  - An error if the value cannot be retrieved or converted.\n\n```go\nfunc (p *ProjectHandler) GetPath(des *resource.DesiredComposed) (string, error)\n```\nGetPath retrieves the path of the GitLab project from the desired resource. It looks up the value at the path \"spec.forProvider.path\" in the resource. Returns:\n\n  - The path as a string if successful.\n  - An error if the value cannot be retrieved.\n\n","path":"github.com/simon-fredrich/function-gitlab-importer/internal/handler/gitlabhandler","name":"gitlabhandler","synopsis":"Package gitlabhandler provides helper types and methods for interacting with GitLab resources in the context of Crossplane compositions.","isRedistributable":true}
