id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
161,700 | argoproj/argo-cd | util/config/reader.go | MarshalLocalYAMLFile | func MarshalLocalYAMLFile(path string, obj interface{}) error {
yamlData, err := yaml.Marshal(obj)
if err == nil {
err = ioutil.WriteFile(path, yamlData, 0600)
}
return err
} | go | func MarshalLocalYAMLFile(path string, obj interface{}) error {
yamlData, err := yaml.Marshal(obj)
if err == nil {
err = ioutil.WriteFile(path, yamlData, 0600)
}
return err
} | [
"func",
"MarshalLocalYAMLFile",
"(",
"path",
"string",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"yamlData",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"ioutil",
".",
"Write... | // MarshalLocalYAMLFile writes JSON or YAML to a file on disk.
// The caller is responsible for checking error return values. | [
"MarshalLocalYAMLFile",
"writes",
"JSON",
"or",
"YAML",
"to",
"a",
"file",
"on",
"disk",
".",
"The",
"caller",
"is",
"responsible",
"for",
"checking",
"error",
"return",
"values",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/config/reader.go#L34-L40 |
161,701 | argoproj/argo-cd | util/config/reader.go | UnmarshalLocalFile | func UnmarshalLocalFile(path string, obj interface{}) error {
data, err := ioutil.ReadFile(path)
if err == nil {
err = unmarshalObject(data, obj)
}
return err
} | go | func UnmarshalLocalFile(path string, obj interface{}) error {
data, err := ioutil.ReadFile(path)
if err == nil {
err = unmarshalObject(data, obj)
}
return err
} | [
"func",
"UnmarshalLocalFile",
"(",
"path",
"string",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"unmarshalObject",
"(",
... | // UnmarshalLocalFile retrieves JSON or YAML from a file on disk.
// The caller is responsible for checking error return values. | [
"UnmarshalLocalFile",
"retrieves",
"JSON",
"or",
"YAML",
"from",
"a",
"file",
"on",
"disk",
".",
"The",
"caller",
"is",
"responsible",
"for",
"checking",
"error",
"return",
"values",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/config/reader.go#L44-L50 |
161,702 | argoproj/argo-cd | util/config/reader.go | UnmarshalRemoteFile | func UnmarshalRemoteFile(url string, obj interface{}) error {
data, err := ReadRemoteFile(url)
if err == nil {
err = unmarshalObject(data, obj)
}
return err
} | go | func UnmarshalRemoteFile(url string, obj interface{}) error {
data, err := ReadRemoteFile(url)
if err == nil {
err = unmarshalObject(data, obj)
}
return err
} | [
"func",
"UnmarshalRemoteFile",
"(",
"url",
"string",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"data",
",",
"err",
":=",
"ReadRemoteFile",
"(",
"url",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"unmarshalObject",
"(",
"data",
","... | // UnmarshalRemoteFile retrieves JSON or YAML through a GET request.
// The caller is responsible for checking error return values. | [
"UnmarshalRemoteFile",
"retrieves",
"JSON",
"or",
"YAML",
"through",
"a",
"GET",
"request",
".",
"The",
"caller",
"is",
"responsible",
"for",
"checking",
"error",
"return",
"values",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/config/reader.go#L54-L60 |
161,703 | argoproj/argo-cd | util/config/reader.go | ReadRemoteFile | func ReadRemoteFile(url string) ([]byte, error) {
var data []byte
resp, err := http.Get(url)
if err == nil {
defer func() {
_ = resp.Body.Close()
}()
data, err = ioutil.ReadAll(resp.Body)
}
return data, err
} | go | func ReadRemoteFile(url string) ([]byte, error) {
var data []byte
resp, err := http.Get(url)
if err == nil {
defer func() {
_ = resp.Body.Close()
}()
data, err = ioutil.ReadAll(resp.Body)
}
return data, err
} | [
"func",
"ReadRemoteFile",
"(",
"url",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"data",
"[",
"]",
"byte",
"\n",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"defe... | // ReadRemoteFile issues a GET request to retrieve the contents of the specified URL as a byte array.
// The caller is responsible for checking error return values. | [
"ReadRemoteFile",
"issues",
"a",
"GET",
"request",
"to",
"retrieve",
"the",
"contents",
"of",
"the",
"specified",
"URL",
"as",
"a",
"byte",
"array",
".",
"The",
"caller",
"is",
"responsible",
"for",
"checking",
"error",
"return",
"values",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/config/reader.go#L64-L74 |
161,704 | argoproj/argo-cd | util/argo/argo.go | FormatAppConditions | func FormatAppConditions(conditions []argoappv1.ApplicationCondition) string {
formattedConditions := make([]string, 0)
for _, condition := range conditions {
formattedConditions = append(formattedConditions, fmt.Sprintf("%s: %s", condition.Type, condition.Message))
}
return strings.Join(formattedConditions, ";")... | go | func FormatAppConditions(conditions []argoappv1.ApplicationCondition) string {
formattedConditions := make([]string, 0)
for _, condition := range conditions {
formattedConditions = append(formattedConditions, fmt.Sprintf("%s: %s", condition.Type, condition.Message))
}
return strings.Join(formattedConditions, ";")... | [
"func",
"FormatAppConditions",
"(",
"conditions",
"[",
"]",
"argoappv1",
".",
"ApplicationCondition",
")",
"string",
"{",
"formattedConditions",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"condition",
":=",
"range",
"conditi... | // FormatAppConditions returns string representation of give app condition list | [
"FormatAppConditions",
"returns",
"string",
"representation",
"of",
"give",
"app",
"condition",
"list"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L41-L47 |
161,705 | argoproj/argo-cd | util/argo/argo.go | FilterByProjects | func FilterByProjects(apps []argoappv1.Application, projects []string) []argoappv1.Application {
if len(projects) == 0 {
return apps
}
projectsMap := make(map[string]bool)
for i := range projects {
projectsMap[projects[i]] = true
}
items := make([]argoappv1.Application, 0)
for i := 0; i < len(apps); i++ {
... | go | func FilterByProjects(apps []argoappv1.Application, projects []string) []argoappv1.Application {
if len(projects) == 0 {
return apps
}
projectsMap := make(map[string]bool)
for i := range projects {
projectsMap[projects[i]] = true
}
items := make([]argoappv1.Application, 0)
for i := 0; i < len(apps); i++ {
... | [
"func",
"FilterByProjects",
"(",
"apps",
"[",
"]",
"argoappv1",
".",
"Application",
",",
"projects",
"[",
"]",
"string",
")",
"[",
"]",
"argoappv1",
".",
"Application",
"{",
"if",
"len",
"(",
"projects",
")",
"==",
"0",
"{",
"return",
"apps",
"\n",
"}"... | // FilterByProjects returns applications which belongs to the specified project | [
"FilterByProjects",
"returns",
"applications",
"which",
"belongs",
"to",
"the",
"specified",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L50-L67 |
161,706 | argoproj/argo-cd | util/argo/argo.go | RefreshApp | func RefreshApp(appIf v1alpha1.ApplicationInterface, name string, refreshType argoappv1.RefreshType) (*argoappv1.Application, error) {
metadata := map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]string{
common.AnnotationKeyRefresh: string(refreshType),
},
},
}
var ... | go | func RefreshApp(appIf v1alpha1.ApplicationInterface, name string, refreshType argoappv1.RefreshType) (*argoappv1.Application, error) {
metadata := map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]string{
common.AnnotationKeyRefresh: string(refreshType),
},
},
}
var ... | [
"func",
"RefreshApp",
"(",
"appIf",
"v1alpha1",
".",
"ApplicationInterface",
",",
"name",
"string",
",",
"refreshType",
"argoappv1",
".",
"RefreshType",
")",
"(",
"*",
"argoappv1",
".",
"Application",
",",
"error",
")",
"{",
"metadata",
":=",
"map",
"[",
"st... | // RefreshApp updates the refresh annotation of an application to coerce the controller to process it | [
"RefreshApp",
"updates",
"the",
"refresh",
"annotation",
"of",
"an",
"application",
"to",
"coerce",
"the",
"controller",
"to",
"process",
"it"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L70-L96 |
161,707 | argoproj/argo-cd | util/argo/argo.go | WaitForRefresh | func WaitForRefresh(ctx context.Context, appIf v1alpha1.ApplicationInterface, name string, timeout *time.Duration) (*argoappv1.Application, error) {
var cancel context.CancelFunc
if timeout != nil {
ctx, cancel = context.WithTimeout(ctx, *timeout)
defer cancel()
}
ch := kube.WatchWithRetry(ctx, func() (i watch.... | go | func WaitForRefresh(ctx context.Context, appIf v1alpha1.ApplicationInterface, name string, timeout *time.Duration) (*argoappv1.Application, error) {
var cancel context.CancelFunc
if timeout != nil {
ctx, cancel = context.WithTimeout(ctx, *timeout)
defer cancel()
}
ch := kube.WatchWithRetry(ctx, func() (i watch.... | [
"func",
"WaitForRefresh",
"(",
"ctx",
"context",
".",
"Context",
",",
"appIf",
"v1alpha1",
".",
"ApplicationInterface",
",",
"name",
"string",
",",
"timeout",
"*",
"time",
".",
"Duration",
")",
"(",
"*",
"argoappv1",
".",
"Application",
",",
"error",
")",
... | // WaitForRefresh watches an application until its comparison timestamp is after the refresh timestamp
// If refresh timestamp is not present, will use current timestamp at time of call | [
"WaitForRefresh",
"watches",
"an",
"application",
"until",
"its",
"comparison",
"timestamp",
"is",
"after",
"the",
"refresh",
"timestamp",
"If",
"refresh",
"timestamp",
"is",
"not",
"present",
"will",
"use",
"current",
"timestamp",
"at",
"time",
"of",
"call"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L100-L128 |
161,708 | argoproj/argo-cd | util/argo/argo.go | GetAppProject | func GetAppProject(spec *argoappv1.ApplicationSpec, projLister applicationsv1.AppProjectLister, ns string) (*argoappv1.AppProject, error) {
return projLister.AppProjects(ns).Get(spec.GetProject())
} | go | func GetAppProject(spec *argoappv1.ApplicationSpec, projLister applicationsv1.AppProjectLister, ns string) (*argoappv1.AppProject, error) {
return projLister.AppProjects(ns).Get(spec.GetProject())
} | [
"func",
"GetAppProject",
"(",
"spec",
"*",
"argoappv1",
".",
"ApplicationSpec",
",",
"projLister",
"applicationsv1",
".",
"AppProjectLister",
",",
"ns",
"string",
")",
"(",
"*",
"argoappv1",
".",
"AppProject",
",",
"error",
")",
"{",
"return",
"projLister",
".... | // GetAppProject returns a project from an application | [
"GetAppProject",
"returns",
"a",
"project",
"from",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L258-L260 |
161,709 | argoproj/argo-cd | util/argo/argo.go | verifyAppYAML | func verifyAppYAML(ctx context.Context, repoRes *argoappv1.Repository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) error {
// Default revision to HEAD if unspecified
if spec.Source.TargetRevision == "" {
spec.Source.TargetRevision = "HEAD"
}
req := repository.GetFileRequest{
... | go | func verifyAppYAML(ctx context.Context, repoRes *argoappv1.Repository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) error {
// Default revision to HEAD if unspecified
if spec.Source.TargetRevision == "" {
spec.Source.TargetRevision = "HEAD"
}
req := repository.GetFileRequest{
... | [
"func",
"verifyAppYAML",
"(",
"ctx",
"context",
".",
"Context",
",",
"repoRes",
"*",
"argoappv1",
".",
"Repository",
",",
"spec",
"*",
"argoappv1",
".",
"ApplicationSpec",
",",
"repoClient",
"repository",
".",
"RepoServerServiceClient",
")",
"error",
"{",
"// De... | // verifyAppYAML verifies that a ksonnet app.yaml is functional | [
"verifyAppYAML",
"verifies",
"that",
"a",
"ksonnet",
"app",
".",
"yaml",
"is",
"functional"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L297-L339 |
161,710 | argoproj/argo-cd | util/argo/argo.go | verifyHelmChart | func verifyHelmChart(ctx context.Context, repoRes *argoappv1.Repository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) []argoappv1.ApplicationCondition {
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == "" || spec.Destination.Namespace == "" {
condition... | go | func verifyHelmChart(ctx context.Context, repoRes *argoappv1.Repository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) []argoappv1.ApplicationCondition {
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == "" || spec.Destination.Namespace == "" {
condition... | [
"func",
"verifyHelmChart",
"(",
"ctx",
"context",
".",
"Context",
",",
"repoRes",
"*",
"argoappv1",
".",
"Repository",
",",
"spec",
"*",
"argoappv1",
".",
"ApplicationSpec",
",",
"repoClient",
"repository",
".",
"RepoServerServiceClient",
")",
"[",
"]",
"argoapp... | // verifyHelmChart verifies a helm chart is functional
// verifyHelmChart verifies a helm chart is functional | [
"verifyHelmChart",
"verifies",
"a",
"helm",
"chart",
"is",
"functional",
"verifyHelmChart",
"verifies",
"a",
"helm",
"chart",
"is",
"functional"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L343-L371 |
161,711 | argoproj/argo-cd | util/argo/argo.go | verifyGenerateManifests | func verifyGenerateManifests(
ctx context.Context, repoRes *argoappv1.Repository, helmRepos []*argoappv1.HelmRepository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) []argoappv1.ApplicationCondition {
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == ""... | go | func verifyGenerateManifests(
ctx context.Context, repoRes *argoappv1.Repository, helmRepos []*argoappv1.HelmRepository, spec *argoappv1.ApplicationSpec, repoClient repository.RepoServerServiceClient) []argoappv1.ApplicationCondition {
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == ""... | [
"func",
"verifyGenerateManifests",
"(",
"ctx",
"context",
".",
"Context",
",",
"repoRes",
"*",
"argoappv1",
".",
"Repository",
",",
"helmRepos",
"[",
"]",
"*",
"argoappv1",
".",
"HelmRepository",
",",
"spec",
"*",
"argoappv1",
".",
"ApplicationSpec",
",",
"rep... | // verifyGenerateManifests verifies a repo path can generate manifests | [
"verifyGenerateManifests",
"verifies",
"a",
"repo",
"path",
"can",
"generate",
"manifests"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L374-L410 |
161,712 | argoproj/argo-cd | util/argo/argo.go | SetAppOperation | func SetAppOperation(appIf v1alpha1.ApplicationInterface, appName string, op *argoappv1.Operation) (*argoappv1.Application, error) {
for {
a, err := appIf.Get(appName, metav1.GetOptions{})
if err != nil {
return nil, err
}
if a.Operation != nil {
return nil, status.Errorf(codes.FailedPrecondition, "anoth... | go | func SetAppOperation(appIf v1alpha1.ApplicationInterface, appName string, op *argoappv1.Operation) (*argoappv1.Application, error) {
for {
a, err := appIf.Get(appName, metav1.GetOptions{})
if err != nil {
return nil, err
}
if a.Operation != nil {
return nil, status.Errorf(codes.FailedPrecondition, "anoth... | [
"func",
"SetAppOperation",
"(",
"appIf",
"v1alpha1",
".",
"ApplicationInterface",
",",
"appName",
"string",
",",
"op",
"*",
"argoappv1",
".",
"Operation",
")",
"(",
"*",
"argoappv1",
".",
"Application",
",",
"error",
")",
"{",
"for",
"{",
"a",
",",
"err",
... | // SetAppOperation updates an application with the specified operation, retrying conflict errors | [
"SetAppOperation",
"updates",
"an",
"application",
"with",
"the",
"specified",
"operation",
"retrying",
"conflict",
"errors"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L413-L436 |
161,713 | argoproj/argo-cd | util/argo/argo.go | ContainsSyncResource | func ContainsSyncResource(name string, gvk schema.GroupVersionKind, rr []argoappv1.SyncOperationResource) bool {
for _, r := range rr {
if r.HasIdentity(name, gvk) {
return true
}
}
return false
} | go | func ContainsSyncResource(name string, gvk schema.GroupVersionKind, rr []argoappv1.SyncOperationResource) bool {
for _, r := range rr {
if r.HasIdentity(name, gvk) {
return true
}
}
return false
} | [
"func",
"ContainsSyncResource",
"(",
"name",
"string",
",",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"rr",
"[",
"]",
"argoappv1",
".",
"SyncOperationResource",
")",
"bool",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"rr",
"{",
"if",
"r",
".",
"HasId... | // ContainsSyncResource determines if the given resource exists in the provided slice of sync operation resources. | [
"ContainsSyncResource",
"determines",
"if",
"the",
"given",
"resource",
"exists",
"in",
"the",
"provided",
"slice",
"of",
"sync",
"operation",
"resources",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/argo.go#L439-L446 |
161,714 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go | Get | func (c *FakeAppProjects) Get(name string, options v1.GetOptions) (result *v1alpha1.AppProject, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(appprojectsResource, c.ns, name), &v1alpha1.AppProject{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.AppProject), err
} | go | func (c *FakeAppProjects) Get(name string, options v1.GetOptions) (result *v1alpha1.AppProject, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(appprojectsResource, c.ns, name), &v1alpha1.AppProject{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.AppProject), err
} | [
"func",
"(",
"c",
"*",
"FakeAppProjects",
")",
"Get",
"(",
"name",
"string",
",",
"options",
"v1",
".",
"GetOptions",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"AppProject",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
... | // Get takes name of the appProject, and returns the corresponding appProject object, and an error if there is any. | [
"Get",
"takes",
"name",
"of",
"the",
"appProject",
"and",
"returns",
"the",
"corresponding",
"appProject",
"object",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go#L26-L34 |
161,715 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go | List | func (c *FakeAppProjects) List(opts v1.ListOptions) (result *v1alpha1.AppProjectList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(appprojectsResource, appprojectsKind, c.ns, opts), &v1alpha1.AppProjectList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(op... | go | func (c *FakeAppProjects) List(opts v1.ListOptions) (result *v1alpha1.AppProjectList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(appprojectsResource, appprojectsKind, c.ns, opts), &v1alpha1.AppProjectList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(op... | [
"func",
"(",
"c",
"*",
"FakeAppProjects",
")",
"List",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"AppProjectList",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
... | // List takes label and field selectors, and returns the list of AppProjects that match those selectors. | [
"List",
"takes",
"label",
"and",
"field",
"selectors",
"and",
"returns",
"the",
"list",
"of",
"AppProjects",
"that",
"match",
"those",
"selectors",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go#L37-L56 |
161,716 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go | Watch | func (c *FakeAppProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(appprojectsResource, c.ns, opts))
} | go | func (c *FakeAppProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(appprojectsResource, c.ns, opts))
} | [
"func",
"(",
"c",
"*",
"FakeAppProjects",
")",
"Watch",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"c",
".",
"Fake",
".",
"InvokesWatch",
"(",
"testing",
".",
"NewWatchAction",
"(",
"ap... | // Watch returns a watch.Interface that watches the requested appProjects. | [
"Watch",
"returns",
"a",
"watch",
".",
"Interface",
"that",
"watches",
"the",
"requested",
"appProjects",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go#L59-L63 |
161,717 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go | Delete | func (c *FakeAppProjects) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(appprojectsResource, c.ns, name), &v1alpha1.AppProject{})
return err
} | go | func (c *FakeAppProjects) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(appprojectsResource, c.ns, name), &v1alpha1.AppProject{})
return err
} | [
"func",
"(",
"c",
"*",
"FakeAppProjects",
")",
"Delete",
"(",
"name",
"string",
",",
"options",
"*",
"v1",
".",
"DeleteOptions",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewDeleteAction",
"(",
... | // Delete takes name of the appProject and deletes it. Returns an error if one occurs. | [
"Delete",
"takes",
"name",
"of",
"the",
"appProject",
"and",
"deletes",
"it",
".",
"Returns",
"an",
"error",
"if",
"one",
"occurs",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go#L88-L93 |
161,718 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go | Patch | func (c *FakeAppProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AppProject, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(appprojectsResource, c.ns, name, data, subresources...), &v1alpha1.AppProject{})
if obj == nil {
return ni... | go | func (c *FakeAppProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AppProject, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(appprojectsResource, c.ns, name, data, subresources...), &v1alpha1.AppProject{})
if obj == nil {
return ni... | [
"func",
"(",
"c",
"*",
"FakeAppProjects",
")",
"Patch",
"(",
"name",
"string",
",",
"pt",
"types",
".",
"PatchType",
",",
"data",
"[",
"]",
"byte",
",",
"subresources",
"...",
"string",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"AppProject",
",",
"err"... | // Patch applies the patch and returns the patched appProject. | [
"Patch",
"applies",
"the",
"patch",
"and",
"returns",
"the",
"patched",
"appProject",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_appproject.go#L104-L112 |
161,719 | argoproj/argo-cd | controller/metrics/metrics.go | NewMetricsServer | func NewMetricsServer(addr string, appLister applister.ApplicationLister) *MetricsServer {
mux := http.NewServeMux()
appRegistry := NewAppRegistry(appLister)
appRegistry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}))
appRegistry.MustRegister(prometheus.NewGoCollector())
mux.Handle(... | go | func NewMetricsServer(addr string, appLister applister.ApplicationLister) *MetricsServer {
mux := http.NewServeMux()
appRegistry := NewAppRegistry(appLister)
appRegistry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}))
appRegistry.MustRegister(prometheus.NewGoCollector())
mux.Handle(... | [
"func",
"NewMetricsServer",
"(",
"addr",
"string",
",",
"appLister",
"applister",
".",
"ApplicationLister",
")",
"*",
"MetricsServer",
"{",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"appRegistry",
":=",
"NewAppRegistry",
"(",
"appLister",
")",
"... | // NewMetricsServer returns a new prometheus server which collects application metrics | [
"NewMetricsServer",
"returns",
"a",
"new",
"prometheus",
"server",
"which",
"collects",
"application",
"metrics"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/metrics/metrics.go#L62-L107 |
161,720 | argoproj/argo-cd | controller/metrics/metrics.go | IncSync | func (m *MetricsServer) IncSync(app *argoappv1.Application, state *argoappv1.OperationState) {
if !state.Phase.Completed() {
return
}
m.syncCounter.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject(), string(state.Phase)).Inc()
} | go | func (m *MetricsServer) IncSync(app *argoappv1.Application, state *argoappv1.OperationState) {
if !state.Phase.Completed() {
return
}
m.syncCounter.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject(), string(state.Phase)).Inc()
} | [
"func",
"(",
"m",
"*",
"MetricsServer",
")",
"IncSync",
"(",
"app",
"*",
"argoappv1",
".",
"Application",
",",
"state",
"*",
"argoappv1",
".",
"OperationState",
")",
"{",
"if",
"!",
"state",
".",
"Phase",
".",
"Completed",
"(",
")",
"{",
"return",
"\n"... | // IncSync increments the sync counter for an application | [
"IncSync",
"increments",
"the",
"sync",
"counter",
"for",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/metrics/metrics.go#L110-L115 |
161,721 | argoproj/argo-cd | controller/metrics/metrics.go | IncKubernetesRequest | func (m *MetricsServer) IncKubernetesRequest(app *argoappv1.Application, statusCode int) {
m.k8sRequestCounter.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject(), strconv.Itoa(statusCode)).Inc()
} | go | func (m *MetricsServer) IncKubernetesRequest(app *argoappv1.Application, statusCode int) {
m.k8sRequestCounter.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject(), strconv.Itoa(statusCode)).Inc()
} | [
"func",
"(",
"m",
"*",
"MetricsServer",
")",
"IncKubernetesRequest",
"(",
"app",
"*",
"argoappv1",
".",
"Application",
",",
"statusCode",
"int",
")",
"{",
"m",
".",
"k8sRequestCounter",
".",
"WithLabelValues",
"(",
"app",
".",
"Namespace",
",",
"app",
".",
... | // IncKubernetesRequest increments the kubernetes requests counter for an application | [
"IncKubernetesRequest",
"increments",
"the",
"kubernetes",
"requests",
"counter",
"for",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/metrics/metrics.go#L118-L120 |
161,722 | argoproj/argo-cd | controller/metrics/metrics.go | IncReconcile | func (m *MetricsServer) IncReconcile(app *argoappv1.Application, duration time.Duration) {
m.reconcileHistogram.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject()).Observe(duration.Seconds())
} | go | func (m *MetricsServer) IncReconcile(app *argoappv1.Application, duration time.Duration) {
m.reconcileHistogram.WithLabelValues(app.Namespace, app.Name, app.Spec.GetProject()).Observe(duration.Seconds())
} | [
"func",
"(",
"m",
"*",
"MetricsServer",
")",
"IncReconcile",
"(",
"app",
"*",
"argoappv1",
".",
"Application",
",",
"duration",
"time",
".",
"Duration",
")",
"{",
"m",
".",
"reconcileHistogram",
".",
"WithLabelValues",
"(",
"app",
".",
"Namespace",
",",
"a... | // IncReconcile increments the reconcile counter for an application | [
"IncReconcile",
"increments",
"the",
"reconcile",
"counter",
"for",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/metrics/metrics.go#L123-L125 |
161,723 | argoproj/argo-cd | controller/metrics/metrics.go | NewAppRegistry | func NewAppRegistry(appLister applister.ApplicationLister) *prometheus.Registry {
registry := prometheus.NewRegistry()
registry.MustRegister(NewAppCollector(appLister))
return registry
} | go | func NewAppRegistry(appLister applister.ApplicationLister) *prometheus.Registry {
registry := prometheus.NewRegistry()
registry.MustRegister(NewAppCollector(appLister))
return registry
} | [
"func",
"NewAppRegistry",
"(",
"appLister",
"applister",
".",
"ApplicationLister",
")",
"*",
"prometheus",
".",
"Registry",
"{",
"registry",
":=",
"prometheus",
".",
"NewRegistry",
"(",
")",
"\n",
"registry",
".",
"MustRegister",
"(",
"NewAppCollector",
"(",
"ap... | // NewAppRegistry creates a new prometheus registry that collects applications | [
"NewAppRegistry",
"creates",
"a",
"new",
"prometheus",
"registry",
"that",
"collects",
"applications"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/metrics/metrics.go#L139-L143 |
161,724 | argoproj/argo-cd | util/localconfig/localconfig.go | Claims | func (u *User) Claims() (*jwt.StandardClaims, error) {
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
claims := jwt.StandardClaims{}
_, _, err := parser.ParseUnverified(u.AuthToken, &claims)
if err != nil {
return nil, err
}
return &claims, nil
} | go | func (u *User) Claims() (*jwt.StandardClaims, error) {
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
claims := jwt.StandardClaims{}
_, _, err := parser.ParseUnverified(u.AuthToken, &claims)
if err != nil {
return nil, err
}
return &claims, nil
} | [
"func",
"(",
"u",
"*",
"User",
")",
"Claims",
"(",
")",
"(",
"*",
"jwt",
".",
"StandardClaims",
",",
"error",
")",
"{",
"parser",
":=",
"&",
"jwt",
".",
"Parser",
"{",
"SkipClaimsValidation",
":",
"true",
",",
"}",
"\n",
"claims",
":=",
"jwt",
".",... | // Claims returns the standard claims from the JWT claims | [
"Claims",
"returns",
"the",
"standard",
"claims",
"from",
"the",
"JWT",
"claims"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L59-L69 |
161,725 | argoproj/argo-cd | util/localconfig/localconfig.go | ReadLocalConfig | func ReadLocalConfig(path string) (*LocalConfig, error) {
var err error
var config LocalConfig
err = configUtil.UnmarshalLocalFile(path, &config)
if os.IsNotExist(err) {
return nil, nil
}
err = ValidateLocalConfig(config)
if err != nil {
return nil, err
}
return &config, nil
} | go | func ReadLocalConfig(path string) (*LocalConfig, error) {
var err error
var config LocalConfig
err = configUtil.UnmarshalLocalFile(path, &config)
if os.IsNotExist(err) {
return nil, nil
}
err = ValidateLocalConfig(config)
if err != nil {
return nil, err
}
return &config, nil
} | [
"func",
"ReadLocalConfig",
"(",
"path",
"string",
")",
"(",
"*",
"LocalConfig",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"var",
"config",
"LocalConfig",
"\n",
"err",
"=",
"configUtil",
".",
"UnmarshalLocalFile",
"(",
"path",
",",
"&",
"config",... | // ReadLocalConfig loads up the local configuration file. Returns nil if config does not exist | [
"ReadLocalConfig",
"loads",
"up",
"the",
"local",
"configuration",
"file",
".",
"Returns",
"nil",
"if",
"config",
"does",
"not",
"exist"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L72-L84 |
161,726 | argoproj/argo-cd | util/localconfig/localconfig.go | WriteLocalConfig | func WriteLocalConfig(config LocalConfig, configPath string) error {
err := os.MkdirAll(path.Dir(configPath), os.ModePerm)
if err != nil {
return err
}
return configUtil.MarshalLocalYAMLFile(configPath, config)
} | go | func WriteLocalConfig(config LocalConfig, configPath string) error {
err := os.MkdirAll(path.Dir(configPath), os.ModePerm)
if err != nil {
return err
}
return configUtil.MarshalLocalYAMLFile(configPath, config)
} | [
"func",
"WriteLocalConfig",
"(",
"config",
"LocalConfig",
",",
"configPath",
"string",
")",
"error",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"path",
".",
"Dir",
"(",
"configPath",
")",
",",
"os",
".",
"ModePerm",
")",
"\n",
"if",
"err",
"!=",
"ni... | // WriteLocalConfig writes a new local configuration file. | [
"WriteLocalConfig",
"writes",
"a",
"new",
"local",
"configuration",
"file",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L97-L103 |
161,727 | argoproj/argo-cd | util/localconfig/localconfig.go | ResolveContext | func (l *LocalConfig) ResolveContext(name string) (*Context, error) {
if name == "" {
name = l.CurrentContext
}
for _, ctx := range l.Contexts {
if ctx.Name == name {
server, err := l.GetServer(ctx.Server)
if err != nil {
return nil, err
}
user, err := l.GetUser(ctx.User)
if err != nil {
r... | go | func (l *LocalConfig) ResolveContext(name string) (*Context, error) {
if name == "" {
name = l.CurrentContext
}
for _, ctx := range l.Contexts {
if ctx.Name == name {
server, err := l.GetServer(ctx.Server)
if err != nil {
return nil, err
}
user, err := l.GetUser(ctx.User)
if err != nil {
r... | [
"func",
"(",
"l",
"*",
"LocalConfig",
")",
"ResolveContext",
"(",
"name",
"string",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"name",
"=",
"l",
".",
"CurrentContext",
"\n",
"}",
"\n",
"for",
"_",
",",
... | // ResolveContext resolves the specified context. If unspecified, resolves the current context | [
"ResolveContext",
"resolves",
"the",
"specified",
"context",
".",
"If",
"unspecified",
"resolves",
"the",
"current",
"context"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L106-L128 |
161,728 | argoproj/argo-cd | util/localconfig/localconfig.go | DefaultConfigDir | func DefaultConfigDir() (string, error) {
usr, err := user.Current()
if err != nil {
return "", err
}
return path.Join(usr.HomeDir, ".argocd"), nil
} | go | func DefaultConfigDir() (string, error) {
usr, err := user.Current()
if err != nil {
return "", err
}
return path.Join(usr.HomeDir, ".argocd"), nil
} | [
"func",
"DefaultConfigDir",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"usr",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"path",
".",... | // DefaultConfigDir returns the local configuration path for settings such as cached authentication tokens. | [
"DefaultConfigDir",
"returns",
"the",
"local",
"configuration",
"path",
"for",
"settings",
"such",
"as",
"cached",
"authentication",
"tokens",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L179-L185 |
161,729 | argoproj/argo-cd | util/localconfig/localconfig.go | DefaultLocalConfigPath | func DefaultLocalConfigPath() (string, error) {
dir, err := DefaultConfigDir()
if err != nil {
return "", err
}
return path.Join(dir, "config"), nil
} | go | func DefaultLocalConfigPath() (string, error) {
dir, err := DefaultConfigDir()
if err != nil {
return "", err
}
return path.Join(dir, "config"), nil
} | [
"func",
"DefaultLocalConfigPath",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"dir",
",",
"err",
":=",
"DefaultConfigDir",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"path",
".",
... | // DefaultLocalConfigPath returns the local configuration path for settings such as cached authentication tokens. | [
"DefaultLocalConfigPath",
"returns",
"the",
"local",
"configuration",
"path",
"for",
"settings",
"such",
"as",
"cached",
"authentication",
"tokens",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/localconfig/localconfig.go#L188-L194 |
161,730 | argoproj/argo-cd | util/tls/tls.go | BestEffortSystemCertPool | func BestEffortSystemCertPool() *x509.CertPool {
rootCAs, _ := x509.SystemCertPool()
if rootCAs == nil {
return x509.NewCertPool()
}
return rootCAs
} | go | func BestEffortSystemCertPool() *x509.CertPool {
rootCAs, _ := x509.SystemCertPool()
if rootCAs == nil {
return x509.NewCertPool()
}
return rootCAs
} | [
"func",
"BestEffortSystemCertPool",
"(",
")",
"*",
"x509",
".",
"CertPool",
"{",
"rootCAs",
",",
"_",
":=",
"x509",
".",
"SystemCertPool",
"(",
")",
"\n",
"if",
"rootCAs",
"==",
"nil",
"{",
"return",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"}",
"\n... | // BestEffortSystemCertPool returns system cert pool as best effort, otherwise an empty cert pool | [
"BestEffortSystemCertPool",
"returns",
"system",
"cert",
"pool",
"as",
"best",
"effort",
"otherwise",
"an",
"empty",
"cert",
"pool"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/tls/tls.go#L54-L60 |
161,731 | argoproj/argo-cd | util/tls/tls.go | generatePEM | func generatePEM(opts CertOptions) ([]byte, []byte, error) {
certBytes, privateKey, err := generate(opts)
if err != nil {
return nil, nil, err
}
certpem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes})
keypem := pem.EncodeToMemory(pemBlockForKey(privateKey))
return certpem, keypem, nil
} | go | func generatePEM(opts CertOptions) ([]byte, []byte, error) {
certBytes, privateKey, err := generate(opts)
if err != nil {
return nil, nil, err
}
certpem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes})
keypem := pem.EncodeToMemory(pemBlockForKey(privateKey))
return certpem, keypem, nil
} | [
"func",
"generatePEM",
"(",
"opts",
"CertOptions",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"certBytes",
",",
"privateKey",
",",
"err",
":=",
"generate",
"(",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retu... | // generatePEM generates a new certificate and key and returns it as PEM encoded bytes | [
"generatePEM",
"generates",
"a",
"new",
"certificate",
"and",
"key",
"and",
"returns",
"it",
"as",
"PEM",
"encoded",
"bytes"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/tls/tls.go#L205-L213 |
161,732 | argoproj/argo-cd | util/tls/tls.go | GenerateX509KeyPair | func GenerateX509KeyPair(opts CertOptions) (*tls.Certificate, error) {
certpem, keypem, err := generatePEM(opts)
if err != nil {
return nil, err
}
cert, err := tls.X509KeyPair(certpem, keypem)
if err != nil {
return nil, err
}
return &cert, nil
} | go | func GenerateX509KeyPair(opts CertOptions) (*tls.Certificate, error) {
certpem, keypem, err := generatePEM(opts)
if err != nil {
return nil, err
}
cert, err := tls.X509KeyPair(certpem, keypem)
if err != nil {
return nil, err
}
return &cert, nil
} | [
"func",
"GenerateX509KeyPair",
"(",
"opts",
"CertOptions",
")",
"(",
"*",
"tls",
".",
"Certificate",
",",
"error",
")",
"{",
"certpem",
",",
"keypem",
",",
"err",
":=",
"generatePEM",
"(",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"ni... | // GenerateX509KeyPair generates a X509 key pair | [
"GenerateX509KeyPair",
"generates",
"a",
"X509",
"key",
"pair"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/tls/tls.go#L216-L226 |
161,733 | argoproj/argo-cd | util/tls/tls.go | EncodeX509KeyPair | func EncodeX509KeyPair(cert tls.Certificate) ([]byte, []byte) {
certpem := []byte{}
for _, certtmp := range cert.Certificate {
certpem = append(certpem, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certtmp})...)
}
keypem := pem.EncodeToMemory(pemBlockForKey(cert.PrivateKey))
return certpem, keypem
... | go | func EncodeX509KeyPair(cert tls.Certificate) ([]byte, []byte) {
certpem := []byte{}
for _, certtmp := range cert.Certificate {
certpem = append(certpem, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certtmp})...)
}
keypem := pem.EncodeToMemory(pemBlockForKey(cert.PrivateKey))
return certpem, keypem
... | [
"func",
"EncodeX509KeyPair",
"(",
"cert",
"tls",
".",
"Certificate",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
")",
"{",
"certpem",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"for",
"_",
",",
"certtmp",
":=",
"range",
"cert",
".",
"Certificat... | // EncodeX509KeyPair encodes a TLS Certificate into its pem encoded format for storage | [
"EncodeX509KeyPair",
"encodes",
"a",
"TLS",
"Certificate",
"into",
"its",
"pem",
"encoded",
"format",
"for",
"storage"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/tls/tls.go#L229-L237 |
161,734 | argoproj/argo-cd | util/tls/tls.go | EncodeX509KeyPairString | func EncodeX509KeyPairString(cert tls.Certificate) (string, string) {
certpem, keypem := EncodeX509KeyPair(cert)
return string(certpem), string(keypem)
} | go | func EncodeX509KeyPairString(cert tls.Certificate) (string, string) {
certpem, keypem := EncodeX509KeyPair(cert)
return string(certpem), string(keypem)
} | [
"func",
"EncodeX509KeyPairString",
"(",
"cert",
"tls",
".",
"Certificate",
")",
"(",
"string",
",",
"string",
")",
"{",
"certpem",
",",
"keypem",
":=",
"EncodeX509KeyPair",
"(",
"cert",
")",
"\n",
"return",
"string",
"(",
"certpem",
")",
",",
"string",
"("... | // EncodeX509KeyPairString encodes a TLS Certificate into its pem encoded string format | [
"EncodeX509KeyPairString",
"encodes",
"a",
"TLS",
"Certificate",
"into",
"its",
"pem",
"encoded",
"string",
"format"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/tls/tls.go#L240-L243 |
161,735 | argoproj/argo-cd | cmd/argocd-util/main.go | NewExportCommand | func NewExportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "export",
Short: "Export all Argo CD data to stdout (default) or a file",
Run: func(c *cobra.Command, args []string) {
config, err := clientConfig.ClientConfig()
... | go | func NewExportCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
out string
)
var command = cobra.Command{
Use: "export",
Short: "Export all Argo CD data to stdout (default) or a file",
Run: func(c *cobra.Command, args []string) {
config, err := clientConfig.ClientConfig()
... | [
"func",
"NewExportCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"clientConfig",
"clientcmd",
".",
"ClientConfig",
"\n",
"out",
"string",
"\n",
")",
"\n",
"var",
"command",
"=",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
... | // NewExportCommand defines a new command for exporting Kubernetes and Argo CD resources. | [
"NewExportCommand",
"defines",
"a",
"new",
"command",
"for",
"exporting",
"Kubernetes",
"and",
"Argo",
"CD",
"resources",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd-util/main.go#L358-L415 |
161,736 | argoproj/argo-cd | cmd/argocd-util/main.go | getReferencedSecrets | func getReferencedSecrets(un unstructured.Unstructured) map[string]bool {
var cm apiv1.ConfigMap
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &cm)
errors.CheckError(err)
referencedSecrets := make(map[string]bool)
if reposRAW, ok := cm.Data["repositories"]; ok {
repoCreds := make([]sett... | go | func getReferencedSecrets(un unstructured.Unstructured) map[string]bool {
var cm apiv1.ConfigMap
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &cm)
errors.CheckError(err)
referencedSecrets := make(map[string]bool)
if reposRAW, ok := cm.Data["repositories"]; ok {
repoCreds := make([]sett... | [
"func",
"getReferencedSecrets",
"(",
"un",
"unstructured",
".",
"Unstructured",
")",
"map",
"[",
"string",
"]",
"bool",
"{",
"var",
"cm",
"apiv1",
".",
"ConfigMap",
"\n",
"err",
":=",
"runtime",
".",
"DefaultUnstructuredConverter",
".",
"FromUnstructured",
"(",
... | // getReferencedSecrets examines the argocd-cm config for any referenced repo secrets and returns a
// map of all referenced secrets. | [
"getReferencedSecrets",
"examines",
"the",
"argocd",
"-",
"cm",
"config",
"for",
"any",
"referenced",
"repo",
"secrets",
"and",
"returns",
"a",
"map",
"of",
"all",
"referenced",
"secrets",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd-util/main.go#L419-L463 |
161,737 | argoproj/argo-cd | cmd/argocd-util/main.go | export | func export(w io.Writer, un unstructured.Unstructured) {
name := un.GetName()
finalizers := un.GetFinalizers()
apiVersion := un.GetAPIVersion()
kind := un.GetKind()
labels := un.GetLabels()
annotations := un.GetAnnotations()
unstructured.RemoveNestedField(un.Object, "metadata")
un.SetName(name)
un.SetFinalizer... | go | func export(w io.Writer, un unstructured.Unstructured) {
name := un.GetName()
finalizers := un.GetFinalizers()
apiVersion := un.GetAPIVersion()
kind := un.GetKind()
labels := un.GetLabels()
annotations := un.GetAnnotations()
unstructured.RemoveNestedField(un.Object, "metadata")
un.SetName(name)
un.SetFinalizer... | [
"func",
"export",
"(",
"w",
"io",
".",
"Writer",
",",
"un",
"unstructured",
".",
"Unstructured",
")",
"{",
"name",
":=",
"un",
".",
"GetName",
"(",
")",
"\n",
"finalizers",
":=",
"un",
".",
"GetFinalizers",
"(",
")",
"\n",
"apiVersion",
":=",
"un",
"... | // export writes the unstructured object and removes extraneous cruft from output before writing | [
"export",
"writes",
"the",
"unstructured",
"object",
"and",
"removes",
"extraneous",
"cruft",
"from",
"output",
"before",
"writing"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd-util/main.go#L491-L511 |
161,738 | argoproj/argo-cd | cmd/argocd-util/main.go | NewClusterConfig | func NewClusterConfig() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = &cobra.Command{
Use: "kubeconfig CLUSTER_URL OUTPUT_PATH",
Short: "Generates kubeconfig for the specified cluster",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args... | go | func NewClusterConfig() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
)
var command = &cobra.Command{
Use: "kubeconfig CLUSTER_URL OUTPUT_PATH",
Short: "Generates kubeconfig for the specified cluster",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args... | [
"func",
"NewClusterConfig",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"clientConfig",
"clientcmd",
".",
"ClientConfig",
"\n",
")",
"\n",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",... | // NewClusterConfig returns a new instance of `argocd-util kubeconfig` command | [
"NewClusterConfig",
"returns",
"a",
"new",
"instance",
"of",
"argocd",
"-",
"util",
"kubeconfig",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd-util/main.go#L514-L543 |
161,739 | argoproj/argo-cd | server/application/application.go | NewServer | func NewServer(
namespace string,
kubeclientset kubernetes.Interface,
appclientset appclientset.Interface,
repoClientset reposerver.Clientset,
cache *cache.Cache,
kubectl kube.Kubectl,
db db.ArgoDB,
enf *rbac.Enforcer,
projectLock *util.KeyLock,
settingsMgr *settings.SettingsManager,
) ApplicationServiceServe... | go | func NewServer(
namespace string,
kubeclientset kubernetes.Interface,
appclientset appclientset.Interface,
repoClientset reposerver.Clientset,
cache *cache.Cache,
kubectl kube.Kubectl,
db db.ArgoDB,
enf *rbac.Enforcer,
projectLock *util.KeyLock,
settingsMgr *settings.SettingsManager,
) ApplicationServiceServe... | [
"func",
"NewServer",
"(",
"namespace",
"string",
",",
"kubeclientset",
"kubernetes",
".",
"Interface",
",",
"appclientset",
"appclientset",
".",
"Interface",
",",
"repoClientset",
"reposerver",
".",
"Clientset",
",",
"cache",
"*",
"cache",
".",
"Cache",
",",
"ku... | // NewServer returns a new instance of the Application service | [
"NewServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Application",
"service"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L61-L88 |
161,740 | argoproj/argo-cd | server/application/application.go | appRBACName | func appRBACName(app appv1.Application) string {
return fmt.Sprintf("%s/%s", app.Spec.GetProject(), app.Name)
} | go | func appRBACName(app appv1.Application) string {
return fmt.Sprintf("%s/%s", app.Spec.GetProject(), app.Name)
} | [
"func",
"appRBACName",
"(",
"app",
"appv1",
".",
"Application",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"app",
".",
"Spec",
".",
"GetProject",
"(",
")",
",",
"app",
".",
"Name",
")",
"\n",
"}"
] | // appRBACName formats fully qualified application name for RBAC check | [
"appRBACName",
"formats",
"fully",
"qualified",
"application",
"name",
"for",
"RBAC",
"check"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L91-L93 |
161,741 | argoproj/argo-cd | server/application/application.go | List | func (s *Server) List(ctx context.Context, q *ApplicationQuery) (*appv1.ApplicationList, error) {
appList, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).List(metav1.ListOptions{})
if err != nil {
return nil, err
}
newItems := make([]appv1.Application, 0)
for _, a := range appList.Items {
if s.enf... | go | func (s *Server) List(ctx context.Context, q *ApplicationQuery) (*appv1.ApplicationList, error) {
appList, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).List(metav1.ListOptions{})
if err != nil {
return nil, err
}
newItems := make([]appv1.Application, 0)
for _, a := range appList.Items {
if s.enf... | [
"func",
"(",
"s",
"*",
"Server",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationQuery",
")",
"(",
"*",
"appv1",
".",
"ApplicationList",
",",
"error",
")",
"{",
"appList",
",",
"err",
":=",
"s",
".",
"appclientset",
"."... | // List returns list of applications | [
"List",
"returns",
"list",
"of",
"applications"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L96-L114 |
161,742 | argoproj/argo-cd | server/application/application.go | Create | func (s *Server) Create(ctx context.Context, q *ApplicationCreateRequest) (*appv1.Application, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionCreate, appRBACName(q.Application)); err != nil {
return nil, err
}
s.projectLock.Lock(q.Application.Spec.Projec... | go | func (s *Server) Create(ctx context.Context, q *ApplicationCreateRequest) (*appv1.Application, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionCreate, appRBACName(q.Application)); err != nil {
return nil, err
}
s.projectLock.Lock(q.Application.Spec.Projec... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationCreateRequest",
")",
"(",
"*",
"appv1",
".",
"Application",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr... | // Create creates an application | [
"Create",
"creates",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L117-L155 |
161,743 | argoproj/argo-cd | server/application/application.go | GetManifests | func (s *Server) GetManifests(ctx context.Context, q *ApplicationManifestQuery) (*repository.ManifestResponse, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.Reso... | go | func (s *Server) GetManifests(ctx context.Context, q *ApplicationManifestQuery) (*repository.ManifestResponse, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.Reso... | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetManifests",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationManifestQuery",
")",
"(",
"*",
"repository",
".",
"ManifestResponse",
",",
"error",
")",
"{",
"a",
",",
"err",
":=",
"s",
".",
"appc... | // GetManifests returns application manifests | [
"GetManifests",
"returns",
"application",
"manifests"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L158-L204 |
161,744 | argoproj/argo-cd | server/application/application.go | Get | func (s *Server) Get(ctx context.Context, q *ApplicationQuery) (*appv1.Application, error) {
appIf := s.appclientset.ArgoprojV1alpha1().Applications(s.ns)
a, err := appIf.Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplica... | go | func (s *Server) Get(ctx context.Context, q *ApplicationQuery) (*appv1.Application, error) {
appIf := s.appclientset.ArgoprojV1alpha1().Applications(s.ns)
a, err := appIf.Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplica... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationQuery",
")",
"(",
"*",
"appv1",
".",
"Application",
",",
"error",
")",
"{",
"appIf",
":=",
"s",
".",
"appclientset",
".",
"ArgoprojV1alpha1",... | // Get returns an application by name | [
"Get",
"returns",
"an",
"application",
"by",
"name"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L207-L231 |
161,745 | argoproj/argo-cd | server/application/application.go | ListResourceEvents | func (s *Server) ListResourceEvents(ctx context.Context, q *ApplicationResourceEventsQuery) (*v1.EventList, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.Resourc... | go | func (s *Server) ListResourceEvents(ctx context.Context, q *ApplicationResourceEventsQuery) (*v1.EventList, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.Resourc... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ListResourceEvents",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationResourceEventsQuery",
")",
"(",
"*",
"v1",
".",
"EventList",
",",
"error",
")",
"{",
"a",
",",
"err",
":=",
"s",
".",
"appclie... | // ListResourceEvents returns a list of event resources | [
"ListResourceEvents",
"returns",
"a",
"list",
"of",
"event",
"resources"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L234-L279 |
161,746 | argoproj/argo-cd | server/application/application.go | Update | func (s *Server) Update(ctx context.Context, q *ApplicationUpdateRequest) (*appv1.Application, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionUpdate, appRBACName(*q.Application)); err != nil {
return nil, err
}
s.projectLock.Lock(q.Application.Spec.Proje... | go | func (s *Server) Update(ctx context.Context, q *ApplicationUpdateRequest) (*appv1.Application, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionUpdate, appRBACName(*q.Application)); err != nil {
return nil, err
}
s.projectLock.Lock(q.Application.Spec.Proje... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationUpdateRequest",
")",
"(",
"*",
"appv1",
".",
"Application",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr... | // Update updates an application | [
"Update",
"updates",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L282-L300 |
161,747 | argoproj/argo-cd | server/application/application.go | UpdateSpec | func (s *Server) UpdateSpec(ctx context.Context, q *ApplicationUpdateSpecRequest) (*appv1.ApplicationSpec, error) {
s.projectLock.Lock(q.Spec.Project)
defer s.projectLock.Unlock(q.Spec.Project)
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return... | go | func (s *Server) UpdateSpec(ctx context.Context, q *ApplicationUpdateSpecRequest) (*appv1.ApplicationSpec, error) {
s.projectLock.Lock(q.Spec.Project)
defer s.projectLock.Unlock(q.Spec.Project)
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
return... | [
"func",
"(",
"s",
"*",
"Server",
")",
"UpdateSpec",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationUpdateSpecRequest",
")",
"(",
"*",
"appv1",
".",
"ApplicationSpec",
",",
"error",
")",
"{",
"s",
".",
"projectLock",
".",
"Lock",
"(",
... | // UpdateSpec updates an application spec and filters out any invalid parameter overrides | [
"UpdateSpec",
"updates",
"an",
"application",
"spec",
"and",
"filters",
"out",
"any",
"invalid",
"parameter",
"overrides"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L303-L337 |
161,748 | argoproj/argo-cd | server/application/application.go | Patch | func (s *Server) Patch(ctx context.Context, q *ApplicationPatchRequest) (*appv1.Application, error) {
patch, err := jsonpatch.DecodePatch([]byte(q.Patch))
if err != nil {
return nil, err
}
app, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
retur... | go | func (s *Server) Patch(ctx context.Context, q *ApplicationPatchRequest) (*appv1.Application, error) {
patch, err := jsonpatch.DecodePatch([]byte(q.Patch))
if err != nil {
return nil, err
}
app, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil {
retur... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Patch",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationPatchRequest",
")",
"(",
"*",
"appv1",
".",
"Application",
",",
"error",
")",
"{",
"patch",
",",
"err",
":=",
"jsonpatch",
".",
"DecodePatc... | // Patch patches an application | [
"Patch",
"patches",
"an",
"application"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L340-L379 |
161,749 | argoproj/argo-cd | server/application/application.go | Delete | func (s *Server) Delete(ctx context.Context, q *ApplicationDeleteRequest) (*ApplicationResponse, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil && !apierr.IsNotFound(err) {
return nil, err
}
s.projectLock.Lock(a.Spec.Project)
defer s.proje... | go | func (s *Server) Delete(ctx context.Context, q *ApplicationDeleteRequest) (*ApplicationResponse, error) {
a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
if err != nil && !apierr.IsNotFound(err) {
return nil, err
}
s.projectLock.Lock(a.Spec.Project)
defer s.proje... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationDeleteRequest",
")",
"(",
"*",
"ApplicationResponse",
",",
"error",
")",
"{",
"a",
",",
"err",
":=",
"s",
".",
"appclientset",
".",
"Argop... | // Delete removes an application and all associated resources | [
"Delete",
"removes",
"an",
"application",
"and",
"all",
"associated",
"resources"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L382-L433 |
161,750 | argoproj/argo-cd | server/application/application.go | PatchResource | func (s *Server) PatchResource(ctx context.Context, q *ApplicationResourcePatchRequest) (*ApplicationResourceResponse, error) {
resourceRequest := &ApplicationResourceRequest{
Name: q.Name,
Namespace: q.Namespace,
ResourceName: q.ResourceName,
Kind: q.Kind,
Version: q.Version,
Group... | go | func (s *Server) PatchResource(ctx context.Context, q *ApplicationResourcePatchRequest) (*ApplicationResourceResponse, error) {
resourceRequest := &ApplicationResourceRequest{
Name: q.Name,
Namespace: q.Namespace,
ResourceName: q.ResourceName,
Kind: q.Kind,
Version: q.Version,
Group... | [
"func",
"(",
"s",
"*",
"Server",
")",
"PatchResource",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationResourcePatchRequest",
")",
"(",
"*",
"ApplicationResourceResponse",
",",
"error",
")",
"{",
"resourceRequest",
":=",
"&",
"ApplicationResour... | // PatchResource patches a resource | [
"PatchResource",
"patches",
"a",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L601-L634 |
161,751 | argoproj/argo-cd | server/application/application.go | DeleteResource | func (s *Server) DeleteResource(ctx context.Context, q *ApplicationResourceDeleteRequest) (*ApplicationResponse, error) {
resourceRequest := &ApplicationResourceRequest{
Name: q.Name,
Namespace: q.Namespace,
ResourceName: q.ResourceName,
Kind: q.Kind,
Version: q.Version,
Group: ... | go | func (s *Server) DeleteResource(ctx context.Context, q *ApplicationResourceDeleteRequest) (*ApplicationResponse, error) {
resourceRequest := &ApplicationResourceRequest{
Name: q.Name,
Namespace: q.Namespace,
ResourceName: q.ResourceName,
Kind: q.Kind,
Version: q.Version,
Group: ... | [
"func",
"(",
"s",
"*",
"Server",
")",
"DeleteResource",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ApplicationResourceDeleteRequest",
")",
"(",
"*",
"ApplicationResponse",
",",
"error",
")",
"{",
"resourceRequest",
":=",
"&",
"ApplicationResourceRequ... | // DeleteResource deletes a specificed resource | [
"DeleteResource",
"deletes",
"a",
"specificed",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L637-L664 |
161,752 | argoproj/argo-cd | server/application/application.go | Sync | func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*appv1.Application, error) {
appIf := s.appclientset.ArgoprojV1alpha1().Applications(s.ns)
a, err := appIf.Get(*syncReq.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpol... | go | func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*appv1.Application, error) {
appIf := s.appclientset.ArgoprojV1alpha1().Applications(s.ns)
a, err := appIf.Get(*syncReq.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpol... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Sync",
"(",
"ctx",
"context",
".",
"Context",
",",
"syncReq",
"*",
"ApplicationSyncRequest",
")",
"(",
"*",
"appv1",
".",
"Application",
",",
"error",
")",
"{",
"appIf",
":=",
"s",
".",
"appclientset",
".",
"Argop... | // Sync syncs an application to its target state | [
"Sync",
"syncs",
"an",
"application",
"to",
"its",
"target",
"state"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L792-L833 |
161,753 | argoproj/argo-cd | server/application/application.go | resolveRevision | func (s *Server) resolveRevision(ctx context.Context, app *appv1.Application, syncReq *ApplicationSyncRequest) (string, string, error) {
ambiguousRevision := syncReq.Revision
if ambiguousRevision == "" {
ambiguousRevision = app.Spec.Source.TargetRevision
}
if git.IsCommitSHA(ambiguousRevision) {
// If it's alre... | go | func (s *Server) resolveRevision(ctx context.Context, app *appv1.Application, syncReq *ApplicationSyncRequest) (string, string, error) {
ambiguousRevision := syncReq.Revision
if ambiguousRevision == "" {
ambiguousRevision = app.Spec.Source.TargetRevision
}
if git.IsCommitSHA(ambiguousRevision) {
// If it's alre... | [
"func",
"(",
"s",
"*",
"Server",
")",
"resolveRevision",
"(",
"ctx",
"context",
".",
"Context",
",",
"app",
"*",
"appv1",
".",
"Application",
",",
"syncReq",
"*",
"ApplicationSyncRequest",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"ambig... | // resolveRevision resolves the git revision specified either in the sync request, or the
// application source, into a concrete commit SHA that will be used for a sync operation. | [
"resolveRevision",
"resolves",
"the",
"git",
"revision",
"specified",
"either",
"in",
"the",
"sync",
"request",
"or",
"the",
"application",
"source",
"into",
"a",
"concrete",
"commit",
"SHA",
"that",
"will",
"be",
"used",
"for",
"a",
"sync",
"operation",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/application/application.go#L886-L910 |
161,754 | argoproj/argo-cd | util/dex/config.go | replaceMapSecrets | func replaceMapSecrets(obj map[string]interface{}, secretValues map[string]string) map[string]interface{} {
newObj := make(map[string]interface{})
for k, v := range obj {
switch val := v.(type) {
case map[string]interface{}:
newObj[k] = replaceMapSecrets(val, secretValues)
case []interface{}:
newObj[k] = ... | go | func replaceMapSecrets(obj map[string]interface{}, secretValues map[string]string) map[string]interface{} {
newObj := make(map[string]interface{})
for k, v := range obj {
switch val := v.(type) {
case map[string]interface{}:
newObj[k] = replaceMapSecrets(val, secretValues)
case []interface{}:
newObj[k] = ... | [
"func",
"replaceMapSecrets",
"(",
"obj",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"secretValues",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"newObj",
":=",
"make",
"(",
"map",
"[",
... | // replaceMapSecrets takes a json object and recursively looks for any secret key references in the
// object and replaces the value with the secret value | [
"replaceMapSecrets",
"takes",
"a",
"json",
"object",
"and",
"recursively",
"looks",
"for",
"any",
"secret",
"key",
"references",
"in",
"the",
"object",
"and",
"replaces",
"the",
"value",
"with",
"the",
"secret",
"value"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/dex/config.go#L71-L86 |
161,755 | argoproj/argo-cd | server/server.go | initializeDefaultProject | func initializeDefaultProject(opts ArgoCDServerOpts) error {
defaultProj := &v1alpha1.AppProject{
ObjectMeta: metav1.ObjectMeta{Name: common.DefaultAppProjectName, Namespace: opts.Namespace},
Spec: v1alpha1.AppProjectSpec{
SourceRepos: []string{"*"},
Destinations: []v1alpha1.Applicat... | go | func initializeDefaultProject(opts ArgoCDServerOpts) error {
defaultProj := &v1alpha1.AppProject{
ObjectMeta: metav1.ObjectMeta{Name: common.DefaultAppProjectName, Namespace: opts.Namespace},
Spec: v1alpha1.AppProjectSpec{
SourceRepos: []string{"*"},
Destinations: []v1alpha1.Applicat... | [
"func",
"initializeDefaultProject",
"(",
"opts",
"ArgoCDServerOpts",
")",
"error",
"{",
"defaultProj",
":=",
"&",
"v1alpha1",
".",
"AppProject",
"{",
"ObjectMeta",
":",
"metav1",
".",
"ObjectMeta",
"{",
"Name",
":",
"common",
".",
"DefaultAppProjectName",
",",
"... | // initializeDefaultProject creates the default project if it does not already exist | [
"initializeDefaultProject",
"creates",
"the",
"default",
"project",
"if",
"it",
"does",
"not",
"already",
"exist"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L133-L148 |
161,756 | argoproj/argo-cd | server/server.go | NewServer | func NewServer(ctx context.Context, opts ArgoCDServerOpts) *ArgoCDServer {
settingsMgr := settings_util.NewSettingsManager(ctx, opts.KubeClientset, opts.Namespace)
settings, err := settingsMgr.InitializeSettings()
errors.CheckError(err)
err = initializeDefaultProject(opts)
errors.CheckError(err)
sessionMgr := uti... | go | func NewServer(ctx context.Context, opts ArgoCDServerOpts) *ArgoCDServer {
settingsMgr := settings_util.NewSettingsManager(ctx, opts.KubeClientset, opts.Namespace)
settings, err := settingsMgr.InitializeSettings()
errors.CheckError(err)
err = initializeDefaultProject(opts)
errors.CheckError(err)
sessionMgr := uti... | [
"func",
"NewServer",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"ArgoCDServerOpts",
")",
"*",
"ArgoCDServer",
"{",
"settingsMgr",
":=",
"settings_util",
".",
"NewSettingsManager",
"(",
"ctx",
",",
"opts",
".",
"KubeClientset",
",",
"opts",
".",
"Names... | // NewServer returns a new instance of the Argo CD API server | [
"NewServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Argo",
"CD",
"API",
"server"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L151-L181 |
161,757 | argoproj/argo-cd | server/server.go | Shutdown | func (a *ArgoCDServer) Shutdown() {
log.Info("Shut down requested")
stopCh := a.stopCh
a.stopCh = nil
if stopCh != nil {
close(stopCh)
}
} | go | func (a *ArgoCDServer) Shutdown() {
log.Info("Shut down requested")
stopCh := a.stopCh
a.stopCh = nil
if stopCh != nil {
close(stopCh)
}
} | [
"func",
"(",
"a",
"*",
"ArgoCDServer",
")",
"Shutdown",
"(",
")",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"stopCh",
":=",
"a",
".",
"stopCh",
"\n",
"a",
".",
"stopCh",
"=",
"nil",
"\n",
"if",
"stopCh",
"!=",
"nil",
"{",
"close",
"(... | // Shutdown stops the Argo CD server | [
"Shutdown",
"stops",
"the",
"Argo",
"CD",
"server"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L281-L288 |
161,758 | argoproj/argo-cd | server/server.go | watchSettings | func (a *ArgoCDServer) watchSettings(ctx context.Context) {
updateCh := make(chan *settings_util.ArgoCDSettings, 1)
a.settingsMgr.Subscribe(updateCh)
prevURL := a.settings.URL
prevOIDCConfig := a.settings.OIDCConfigRAW
prevDexCfgBytes, err := dex.GenerateDexConfigYAML(a.settings)
errors.CheckError(err)
prevGitH... | go | func (a *ArgoCDServer) watchSettings(ctx context.Context) {
updateCh := make(chan *settings_util.ArgoCDSettings, 1)
a.settingsMgr.Subscribe(updateCh)
prevURL := a.settings.URL
prevOIDCConfig := a.settings.OIDCConfigRAW
prevDexCfgBytes, err := dex.GenerateDexConfigYAML(a.settings)
errors.CheckError(err)
prevGitH... | [
"func",
"(",
"a",
"*",
"ArgoCDServer",
")",
"watchSettings",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"updateCh",
":=",
"make",
"(",
"chan",
"*",
"settings_util",
".",
"ArgoCDSettings",
",",
"1",
")",
"\n",
"a",
".",
"settingsMgr",
".",
"Subscrib... | // watchSettings watches the configmap and secret for any setting updates that would warrant a
// restart of the API server. | [
"watchSettings",
"watches",
"the",
"configmap",
"and",
"secret",
"for",
"any",
"setting",
"updates",
"that",
"would",
"warrant",
"a",
"restart",
"of",
"the",
"API",
"server",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L292-L350 |
161,759 | argoproj/argo-cd | server/server.go | translateGrpcCookieHeader | func (a *ArgoCDServer) translateGrpcCookieHeader(ctx context.Context, w http.ResponseWriter, resp golang_proto.Message) error {
if sessionResp, ok := resp.(*session.SessionResponse); ok {
flags := []string{"path=/"}
if !a.Insecure {
flags = append(flags, "Secure")
}
cookie, err := httputil.MakeCookieMetadat... | go | func (a *ArgoCDServer) translateGrpcCookieHeader(ctx context.Context, w http.ResponseWriter, resp golang_proto.Message) error {
if sessionResp, ok := resp.(*session.SessionResponse); ok {
flags := []string{"path=/"}
if !a.Insecure {
flags = append(flags, "Secure")
}
cookie, err := httputil.MakeCookieMetadat... | [
"func",
"(",
"a",
"*",
"ArgoCDServer",
")",
"translateGrpcCookieHeader",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"resp",
"golang_proto",
".",
"Message",
")",
"error",
"{",
"if",
"sessionResp",
",",
"ok",
":=",
"... | // TranslateGrpcCookieHeader conditionally sets a cookie on the response. | [
"TranslateGrpcCookieHeader",
"conditionally",
"sets",
"a",
"cookie",
"on",
"the",
"response",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L432-L446 |
161,760 | argoproj/argo-cd | server/server.go | registerDexHandlers | func (a *ArgoCDServer) registerDexHandlers(mux *http.ServeMux) {
if !a.settings.IsSSOConfigured() {
return
}
// Run dex OpenID Connect Identity Provider behind a reverse proxy (served at /api/dex)
var err error
mux.HandleFunc(common.DexAPIEndpoint+"/", dexutil.NewDexHTTPReverseProxy(a.DexServerAddr))
tlsConfig ... | go | func (a *ArgoCDServer) registerDexHandlers(mux *http.ServeMux) {
if !a.settings.IsSSOConfigured() {
return
}
// Run dex OpenID Connect Identity Provider behind a reverse proxy (served at /api/dex)
var err error
mux.HandleFunc(common.DexAPIEndpoint+"/", dexutil.NewDexHTTPReverseProxy(a.DexServerAddr))
tlsConfig ... | [
"func",
"(",
"a",
"*",
"ArgoCDServer",
")",
"registerDexHandlers",
"(",
"mux",
"*",
"http",
".",
"ServeMux",
")",
"{",
"if",
"!",
"a",
".",
"settings",
".",
"IsSSOConfigured",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"// Run dex OpenID Connect Identity Prov... | // registerDexHandlers will register dex HTTP handlers, creating the the OAuth client app | [
"registerDexHandlers",
"will",
"register",
"dex",
"HTTP",
"handlers",
"creating",
"the",
"the",
"OAuth",
"client",
"app"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L524-L537 |
161,761 | argoproj/argo-cd | server/server.go | newRedirectServer | func newRedirectServer(port int) *http.Server {
return &http.Server{
Addr: fmt.Sprintf("localhost:%d", port),
Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
target += "?" + req.URL.RawQuery
}
h... | go | func newRedirectServer(port int) *http.Server {
return &http.Server{
Addr: fmt.Sprintf("localhost:%d", port),
Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
target += "?" + req.URL.RawQuery
}
h... | [
"func",
"newRedirectServer",
"(",
"port",
"int",
")",
"*",
"http",
".",
"Server",
"{",
"return",
"&",
"http",
".",
"Server",
"{",
"Addr",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"port",
")",
",",
"Handler",
":",
"http",
".",
"HandlerFunc",
... | // newRedirectServer returns an HTTP server which does a 307 redirect to the HTTPS server | [
"newRedirectServer",
"returns",
"an",
"HTTP",
"server",
"which",
"does",
"a",
"307",
"redirect",
"to",
"the",
"HTTPS",
"server"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L540-L551 |
161,762 | argoproj/argo-cd | server/server.go | newAPIServerMetricsServer | func newAPIServerMetricsServer() *http.Server {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
return &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%d", common.PortArgoCDAPIServerMetrics),
Handler: mux,
}
} | go | func newAPIServerMetricsServer() *http.Server {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
return &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%d", common.PortArgoCDAPIServerMetrics),
Handler: mux,
}
} | [
"func",
"newAPIServerMetricsServer",
"(",
")",
"*",
"http",
".",
"Server",
"{",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"promhttp",
".",
"Handler",
"(",
")",
")",
"\n",
"return",
"&",
"http... | // newAPIServerMetricsServer returns HTTP server which serves prometheus metrics on gRPC requests | [
"newAPIServerMetricsServer",
"returns",
"HTTP",
"server",
"which",
"serves",
"prometheus",
"metrics",
"on",
"gRPC",
"requests"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L604-L611 |
161,763 | argoproj/argo-cd | server/server.go | newStaticAssetsHandler | func newStaticAssetsHandler(dir string, baseHRef string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
acceptHTML := false
for _, acceptType := range strings.Split(r.Header.Get("Accept"), ",") {
if acceptType == "text/html" || acceptType == "html" {
acceptH... | go | func newStaticAssetsHandler(dir string, baseHRef string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
acceptHTML := false
for _, acceptType := range strings.Split(r.Header.Get("Accept"), ",") {
if acceptType == "text/html" || acceptType == "html" {
acceptH... | [
"func",
"newStaticAssetsHandler",
"(",
"dir",
"string",
",",
"baseHRef",
"string",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"htt... | // newStaticAssetsHandler returns an HTTP handler to serve UI static assets | [
"newStaticAssetsHandler",
"returns",
"an",
"HTTP",
"handler",
"to",
"serve",
"UI",
"static",
"assets"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L614-L640 |
161,764 | argoproj/argo-cd | server/server.go | mustRegisterGWHandler | func mustRegisterGWHandler(register registerFunc, ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) {
err := register(ctx, mux, endpoint, opts)
if err != nil {
panic(err)
}
} | go | func mustRegisterGWHandler(register registerFunc, ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) {
err := register(ctx, mux, endpoint, opts)
if err != nil {
panic(err)
}
} | [
"func",
"mustRegisterGWHandler",
"(",
"register",
"registerFunc",
",",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"endpoint",
"string",
",",
"opts",
"[",
"]",
"grpc",
".",
"DialOption",
")",
"{",
"err",
":=",
"regis... | // mustRegisterGWHandler is a convenience function to register a gateway handler | [
"mustRegisterGWHandler",
"is",
"a",
"convenience",
"function",
"to",
"register",
"a",
"gateway",
"handler"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L645-L650 |
161,765 | argoproj/argo-cd | server/server.go | authenticate | func (a *ArgoCDServer) authenticate(ctx context.Context) (context.Context, error) {
if a.DisableAuth {
return ctx, nil
}
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return ctx, ErrNoSession
}
tokenString := getToken(md)
if tokenString == "" {
return ctx, ErrNoSession
}
claims, err := a.sessionMg... | go | func (a *ArgoCDServer) authenticate(ctx context.Context) (context.Context, error) {
if a.DisableAuth {
return ctx, nil
}
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return ctx, ErrNoSession
}
tokenString := getToken(md)
if tokenString == "" {
return ctx, ErrNoSession
}
claims, err := a.sessionMg... | [
"func",
"(",
"a",
"*",
"ArgoCDServer",
")",
"authenticate",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"if",
"a",
".",
"DisableAuth",
"{",
"return",
"ctx",
",",
"nil",
"\n",
"}",
"\n",
"md",
... | // Authenticate checks for the presence of a valid token when accessing server-side resources. | [
"Authenticate",
"checks",
"for",
"the",
"presence",
"of",
"a",
"valid",
"token",
"when",
"accessing",
"server",
"-",
"side",
"resources",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L653-L672 |
161,766 | argoproj/argo-cd | server/server.go | getToken | func getToken(md metadata.MD) string {
// check the "token" metadata
tokens, ok := md[apiclient.MetaDataTokenKey]
if ok && len(tokens) > 0 {
return tokens[0]
}
// check the HTTP cookie
for _, cookieToken := range md["grpcgateway-cookie"] {
header := http.Header{}
header.Add("Cookie", cookieToken)
request ... | go | func getToken(md metadata.MD) string {
// check the "token" metadata
tokens, ok := md[apiclient.MetaDataTokenKey]
if ok && len(tokens) > 0 {
return tokens[0]
}
// check the HTTP cookie
for _, cookieToken := range md["grpcgateway-cookie"] {
header := http.Header{}
header.Add("Cookie", cookieToken)
request ... | [
"func",
"getToken",
"(",
"md",
"metadata",
".",
"MD",
")",
"string",
"{",
"// check the \"token\" metadata",
"tokens",
",",
"ok",
":=",
"md",
"[",
"apiclient",
".",
"MetaDataTokenKey",
"]",
"\n",
"if",
"ok",
"&&",
"len",
"(",
"tokens",
")",
">",
"0",
"{"... | // getToken extracts the token from gRPC metadata or cookie headers | [
"getToken",
"extracts",
"the",
"token",
"from",
"gRPC",
"metadata",
"or",
"cookie",
"headers"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/server.go#L675-L692 |
161,767 | argoproj/argo-cd | util/http/http.go | MakeCookieMetadata | func MakeCookieMetadata(key, value string, flags ...string) (string, error) {
components := []string{
fmt.Sprintf("%s=%s", key, value),
}
components = append(components, flags...)
header := strings.Join(components, "; ")
const maxLength = 4093
if len(header) > maxLength {
return "", fmt.Errorf("invalid cooki... | go | func MakeCookieMetadata(key, value string, flags ...string) (string, error) {
components := []string{
fmt.Sprintf("%s=%s", key, value),
}
components = append(components, flags...)
header := strings.Join(components, "; ")
const maxLength = 4093
if len(header) > maxLength {
return "", fmt.Errorf("invalid cooki... | [
"func",
"MakeCookieMetadata",
"(",
"key",
",",
"value",
"string",
",",
"flags",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"components",
":=",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"value"... | // MakeCookieMetadata generates a string representing a Web cookie. Yum! | [
"MakeCookieMetadata",
"generates",
"a",
"string",
"representing",
"a",
"Web",
"cookie",
".",
"Yum!"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/http/http.go#L13-L25 |
161,768 | argoproj/argo-cd | util/ksonnet/ksonnet.go | Destination | func Destination(data []byte, environment string) (*v1alpha1.ApplicationDestination, error) {
var appSpec struct {
Environments map[string]struct {
Destination v1alpha1.ApplicationDestination
}
}
err := yaml.Unmarshal(data, &appSpec)
if err != nil {
return nil, fmt.Errorf("could not unmarshal ksonnet spec ... | go | func Destination(data []byte, environment string) (*v1alpha1.ApplicationDestination, error) {
var appSpec struct {
Environments map[string]struct {
Destination v1alpha1.ApplicationDestination
}
}
err := yaml.Unmarshal(data, &appSpec)
if err != nil {
return nil, fmt.Errorf("could not unmarshal ksonnet spec ... | [
"func",
"Destination",
"(",
"data",
"[",
"]",
"byte",
",",
"environment",
"string",
")",
"(",
"*",
"v1alpha1",
".",
"ApplicationDestination",
",",
"error",
")",
"{",
"var",
"appSpec",
"struct",
"{",
"Environments",
"map",
"[",
"string",
"]",
"struct",
"{",... | // Destination returns the deployment destination for an environment in app spec data | [
"Destination",
"returns",
"the",
"deployment",
"destination",
"for",
"an",
"environment",
"in",
"app",
"spec",
"data"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L21-L38 |
161,769 | argoproj/argo-cd | util/ksonnet/ksonnet.go | KsonnetVersion | func KsonnetVersion() (string, error) {
ksApp := ksonnetApp{}
out, err := ksApp.ksCmd("", "version")
if err != nil {
return "", fmt.Errorf("unable to determine ksonnet version: %v", err)
}
ksonnetVersionStr := strings.Split(out, "\n")[0]
parts := strings.SplitN(ksonnetVersionStr, ":", 2)
if len(parts) != 2 {
... | go | func KsonnetVersion() (string, error) {
ksApp := ksonnetApp{}
out, err := ksApp.ksCmd("", "version")
if err != nil {
return "", fmt.Errorf("unable to determine ksonnet version: %v", err)
}
ksonnetVersionStr := strings.Split(out, "\n")[0]
parts := strings.SplitN(ksonnetVersionStr, ":", 2)
if len(parts) != 2 {
... | [
"func",
"KsonnetVersion",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"ksApp",
":=",
"ksonnetApp",
"{",
"}",
"\n",
"out",
",",
"err",
":=",
"ksApp",
".",
"ksCmd",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // KsonnetVersion returns the version of ksonnet used when running ksonnet commands | [
"KsonnetVersion",
"returns",
"the",
"version",
"of",
"ksonnet",
"used",
"when",
"running",
"ksonnet",
"commands"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L60-L72 |
161,770 | argoproj/argo-cd | util/ksonnet/ksonnet.go | NewKsonnetApp | func NewKsonnetApp(path string) (KsonnetApp, error) {
ksApp := ksonnetApp{rootDir: path}
// ensure that the file exists
if _, err := ksApp.appYamlPath(); err != nil {
return nil, err
}
return &ksApp, nil
} | go | func NewKsonnetApp(path string) (KsonnetApp, error) {
ksApp := ksonnetApp{rootDir: path}
// ensure that the file exists
if _, err := ksApp.appYamlPath(); err != nil {
return nil, err
}
return &ksApp, nil
} | [
"func",
"NewKsonnetApp",
"(",
"path",
"string",
")",
"(",
"KsonnetApp",
",",
"error",
")",
"{",
"ksApp",
":=",
"ksonnetApp",
"{",
"rootDir",
":",
"path",
"}",
"\n",
"// ensure that the file exists",
"if",
"_",
",",
"err",
":=",
"ksApp",
".",
"appYamlPath",
... | // NewKsonnetApp tries to create a new wrapper to run commands on the `ks` command-line tool. | [
"NewKsonnetApp",
"tries",
"to",
"create",
"a",
"new",
"wrapper",
"to",
"run",
"commands",
"on",
"the",
"ks",
"command",
"-",
"line",
"tool",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L79-L86 |
161,771 | argoproj/argo-cd | util/ksonnet/ksonnet.go | Show | func (k *ksonnetApp) Show(environment string) ([]*unstructured.Unstructured, error) {
out, err := k.ksCmd("show", environment)
if err != nil {
return nil, fmt.Errorf("`ks show` failed: %v", err)
}
return kube.SplitYAML(out)
} | go | func (k *ksonnetApp) Show(environment string) ([]*unstructured.Unstructured, error) {
out, err := k.ksCmd("show", environment)
if err != nil {
return nil, fmt.Errorf("`ks show` failed: %v", err)
}
return kube.SplitYAML(out)
} | [
"func",
"(",
"k",
"*",
"ksonnetApp",
")",
"Show",
"(",
"environment",
"string",
")",
"(",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"k",
".",
"ksCmd",
"(",
"\"",
"\"",
",",
"environment",
"... | // Show generates a concatenated list of Kubernetes manifests in the given environment. | [
"Show",
"generates",
"a",
"concatenated",
"list",
"of",
"Kubernetes",
"manifests",
"in",
"the",
"given",
"environment",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L123-L129 |
161,772 | argoproj/argo-cd | util/ksonnet/ksonnet.go | Destination | func (k *ksonnetApp) Destination(environment string) (*v1alpha1.ApplicationDestination, error) {
p, err := k.appYamlPath()
if err != nil {
return nil, err
}
data, err := ioutil.ReadFile(p)
if err != nil {
return nil, err
}
return Destination(data, environment)
} | go | func (k *ksonnetApp) Destination(environment string) (*v1alpha1.ApplicationDestination, error) {
p, err := k.appYamlPath()
if err != nil {
return nil, err
}
data, err := ioutil.ReadFile(p)
if err != nil {
return nil, err
}
return Destination(data, environment)
} | [
"func",
"(",
"k",
"*",
"ksonnetApp",
")",
"Destination",
"(",
"environment",
"string",
")",
"(",
"*",
"v1alpha1",
".",
"ApplicationDestination",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"k",
".",
"appYamlPath",
"(",
")",
"\n",
"if",
"err",
"!=",
... | // Destination returns the deployment destination for an environment | [
"Destination",
"returns",
"the",
"deployment",
"destination",
"for",
"an",
"environment"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L132-L142 |
161,773 | argoproj/argo-cd | util/ksonnet/ksonnet.go | ListParams | func (k *ksonnetApp) ListParams(environment string) ([]*v1alpha1.KsonnetParameter, error) {
args := []string{"param", "list", "--output", "json"}
if environment != "" {
args = append(args, "--env", environment)
}
out, err := k.ksCmd(args...)
if err != nil {
return nil, err
}
// Auxiliary data to hold unmarsh... | go | func (k *ksonnetApp) ListParams(environment string) ([]*v1alpha1.KsonnetParameter, error) {
args := []string{"param", "list", "--output", "json"}
if environment != "" {
args = append(args, "--env", environment)
}
out, err := k.ksCmd(args...)
if err != nil {
return nil, err
}
// Auxiliary data to hold unmarsh... | [
"func",
"(",
"k",
"*",
"ksonnetApp",
")",
"ListParams",
"(",
"environment",
"string",
")",
"(",
"[",
"]",
"*",
"v1alpha1",
".",
"KsonnetParameter",
",",
"error",
")",
"{",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"... | // ListParams returns list of ksonnet parameters | [
"ListParams",
"returns",
"list",
"of",
"ksonnet",
"parameters"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L145-L175 |
161,774 | argoproj/argo-cd | util/ksonnet/ksonnet.go | SetComponentParams | func (k *ksonnetApp) SetComponentParams(environment string, component string, param string, value string) error {
_, err := k.ksCmd("param", "set", component, param, value, "--env", environment)
return err
} | go | func (k *ksonnetApp) SetComponentParams(environment string, component string, param string, value string) error {
_, err := k.ksCmd("param", "set", component, param, value, "--env", environment)
return err
} | [
"func",
"(",
"k",
"*",
"ksonnetApp",
")",
"SetComponentParams",
"(",
"environment",
"string",
",",
"component",
"string",
",",
"param",
"string",
",",
"value",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"k",
".",
"ksCmd",
"(",
"\"",
"\"",
",",... | // SetComponentParams updates component parameter in specified environment. | [
"SetComponentParams",
"updates",
"component",
"parameter",
"in",
"specified",
"environment",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/ksonnet/ksonnet.go#L178-L181 |
161,775 | argoproj/argo-cd | server/settings/settings.go | Get | func (s *Server) Get(ctx context.Context, q *SettingsQuery) (*Settings, error) {
argoCDSettings, err := s.mgr.GetSettings()
if err != nil {
return nil, err
}
overrides := make(map[string]*v1alpha1.ResourceOverride)
for k := range argoCDSettings.ResourceOverrides {
val := argoCDSettings.ResourceOverrides[k]
... | go | func (s *Server) Get(ctx context.Context, q *SettingsQuery) (*Settings, error) {
argoCDSettings, err := s.mgr.GetSettings()
if err != nil {
return nil, err
}
overrides := make(map[string]*v1alpha1.ResourceOverride)
for k := range argoCDSettings.ResourceOverrides {
val := argoCDSettings.ResourceOverrides[k]
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"SettingsQuery",
")",
"(",
"*",
"Settings",
",",
"error",
")",
"{",
"argoCDSettings",
",",
"err",
":=",
"s",
".",
"mgr",
".",
"GetSettings",
"(",
")"... | // Get returns Argo CD settings | [
"Get",
"returns",
"Argo",
"CD",
"settings"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/settings/settings.go#L24-L56 |
161,776 | argoproj/argo-cd | server/settings/settings.go | AuthFuncOverride | func (s *Server) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {
return ctx, nil
} | go | func (s *Server) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {
return ctx, nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"AuthFuncOverride",
"(",
"ctx",
"context",
".",
"Context",
",",
"fullMethodName",
"string",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"return",
"ctx",
",",
"nil",
"\n",
"}"
] | // AuthFuncOverride disables authentication for settings service | [
"AuthFuncOverride",
"disables",
"authentication",
"for",
"settings",
"service"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/settings/settings.go#L59-L61 |
161,777 | argoproj/argo-cd | util/json/json.go | NewDecoder | func (j *JSONMarshaler) NewDecoder(r io.Reader) gwruntime.Decoder {
return json.NewDecoder(r)
} | go | func (j *JSONMarshaler) NewDecoder(r io.Reader) gwruntime.Decoder {
return json.NewDecoder(r)
} | [
"func",
"(",
"j",
"*",
"JSONMarshaler",
")",
"NewDecoder",
"(",
"r",
"io",
".",
"Reader",
")",
"gwruntime",
".",
"Decoder",
"{",
"return",
"json",
".",
"NewDecoder",
"(",
"r",
")",
"\n",
"}"
] | // NewDecoder implements gwruntime.Marshaler. | [
"NewDecoder",
"implements",
"gwruntime",
".",
"Marshaler",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/json/json.go#L24-L26 |
161,778 | argoproj/argo-cd | util/json/json.go | NewEncoder | func (j *JSONMarshaler) NewEncoder(w io.Writer) gwruntime.Encoder {
return json.NewEncoder(w)
} | go | func (j *JSONMarshaler) NewEncoder(w io.Writer) gwruntime.Encoder {
return json.NewEncoder(w)
} | [
"func",
"(",
"j",
"*",
"JSONMarshaler",
")",
"NewEncoder",
"(",
"w",
"io",
".",
"Writer",
")",
"gwruntime",
".",
"Encoder",
"{",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
"\n",
"}"
] | // NewEncoder implements gwruntime.Marshaler. | [
"NewEncoder",
"implements",
"gwruntime",
".",
"Marshaler",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/json/json.go#L29-L31 |
161,779 | argoproj/argo-cd | util/json/json.go | Unmarshal | func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error {
return json.Unmarshal(data, v)
} | go | func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error {
return json.Unmarshal(data, v)
} | [
"func",
"(",
"j",
"*",
"JSONMarshaler",
")",
"Unmarshal",
"(",
"data",
"[",
"]",
"byte",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"v",
")",
"\n",
"}"
] | // Unmarshal implements gwruntime.Marshaler. | [
"Unmarshal",
"implements",
"gwruntime",
".",
"Marshaler",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/json/json.go#L34-L36 |
161,780 | argoproj/argo-cd | util/json/json.go | RemoveMapFields | func RemoveMapFields(config, live map[string]interface{}) map[string]interface{} {
result := map[string]interface{}{}
for k, v1 := range config {
v2, ok := live[k]
if !ok {
continue
}
if v2 != nil {
v2 = removeFields(v1, v2)
}
result[k] = v2
}
return result
} | go | func RemoveMapFields(config, live map[string]interface{}) map[string]interface{} {
result := map[string]interface{}{}
for k, v1 := range config {
v2, ok := live[k]
if !ok {
continue
}
if v2 != nil {
v2 = removeFields(v1, v2)
}
result[k] = v2
}
return result
} | [
"func",
"RemoveMapFields",
"(",
"config",
",",
"live",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"result",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"... | // RemoveMapFields remove all non-existent fields in the live that don't exist in the config | [
"RemoveMapFields",
"remove",
"all",
"non",
"-",
"existent",
"fields",
"in",
"the",
"live",
"that",
"don",
"t",
"exist",
"in",
"the",
"config"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/json/json.go#L51-L64 |
161,781 | argoproj/argo-cd | util/json/json.go | MustMarshal | func MustMarshal(v interface{}) []byte {
bytes, err := json.Marshal(v)
if err != nil {
panic(err)
}
return bytes
} | go | func MustMarshal(v interface{}) []byte {
bytes, err := json.Marshal(v)
if err != nil {
panic(err)
}
return bytes
} | [
"func",
"MustMarshal",
"(",
"v",
"interface",
"{",
"}",
")",
"[",
"]",
"byte",
"{",
"bytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"byt... | // MustMarshal is a convenience function to marshal an object successfully or panic | [
"MustMarshal",
"is",
"a",
"convenience",
"function",
"to",
"marshal",
"an",
"object",
"successfully",
"or",
"panic"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/json/json.go#L84-L90 |
161,782 | argoproj/argo-cd | pkg/client/informers/externalversions/application/v1alpha1/application.go | NewApplicationInformer | func NewApplicationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredApplicationInformer(client, namespace, resyncPeriod, indexers, nil)
} | go | func NewApplicationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredApplicationInformer(client, namespace, resyncPeriod, indexers, nil)
} | [
"func",
"NewApplicationInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"cache",
".",
"Indexers",
")",
"cache",
".",
"SharedIndexInformer",
"{",
"return",
"NewFilter... | // NewApplicationInformer constructs a new informer for Application type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. | [
"NewApplicationInformer",
"constructs",
"a",
"new",
"informer",
"for",
"Application",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
".",
"Thi... | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/informers/externalversions/application/v1alpha1/application.go#L34-L36 |
161,783 | argoproj/argo-cd | pkg/client/informers/externalversions/application/v1alpha1/application.go | NewFilteredApplicationInformer | func NewFilteredApplicationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions)... | go | func NewFilteredApplicationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions)... | [
"func",
"NewFilteredApplicationInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"cache",
".",
"Indexers",
",",
"tweakListOptions",
"internalinterfaces",
".",
"TweakListO... | // NewFilteredApplicationInformer constructs a new informer for Application type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. | [
"NewFilteredApplicationInformer",
"constructs",
"a",
"new",
"informer",
"for",
"Application",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
"."... | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/informers/externalversions/application/v1alpha1/application.go#L41-L61 |
161,784 | argoproj/argo-cd | util/db/db.go | NewDB | func NewDB(namespace string, settingsMgr *settings.SettingsManager, kubeclientset kubernetes.Interface) ArgoDB {
return &db{
settingsMgr: settingsMgr,
ns: namespace,
kubeclientset: kubeclientset,
}
} | go | func NewDB(namespace string, settingsMgr *settings.SettingsManager, kubeclientset kubernetes.Interface) ArgoDB {
return &db{
settingsMgr: settingsMgr,
ns: namespace,
kubeclientset: kubeclientset,
}
} | [
"func",
"NewDB",
"(",
"namespace",
"string",
",",
"settingsMgr",
"*",
"settings",
".",
"SettingsManager",
",",
"kubeclientset",
"kubernetes",
".",
"Interface",
")",
"ArgoDB",
"{",
"return",
"&",
"db",
"{",
"settingsMgr",
":",
"settingsMgr",
",",
"ns",
":",
"... | // NewDB returns a new instance of the argo database | [
"NewDB",
"returns",
"a",
"new",
"instance",
"of",
"the",
"argo",
"database"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/db.go#L49-L55 |
161,785 | argoproj/argo-cd | util/git/git.go | removeSuffix | func removeSuffix(s, suffix string) string {
if strings.HasSuffix(s, suffix) {
return s[0 : len(s)-len(suffix)]
}
return s
} | go | func removeSuffix(s, suffix string) string {
if strings.HasSuffix(s, suffix) {
return s[0 : len(s)-len(suffix)]
}
return s
} | [
"func",
"removeSuffix",
"(",
"s",
",",
"suffix",
"string",
")",
"string",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"suffix",
")",
"{",
"return",
"s",
"[",
"0",
":",
"len",
"(",
"s",
")",
"-",
"len",
"(",
"suffix",
")",
"]",
"\n",
... | // removeSuffix idempotently removes a given suffix | [
"removeSuffix",
"idempotently",
"removes",
"a",
"given",
"suffix"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/git/git.go#L18-L23 |
161,786 | argoproj/argo-cd | util/git/git.go | IsSSHURL | func IsSSHURL(url string) bool {
return strings.HasPrefix(url, "git@") || strings.HasPrefix(url, "ssh://")
} | go | func IsSSHURL(url string) bool {
return strings.HasPrefix(url, "git@") || strings.HasPrefix(url, "ssh://")
} | [
"func",
"IsSSHURL",
"(",
"url",
"string",
")",
"bool",
"{",
"return",
"strings",
".",
"HasPrefix",
"(",
"url",
",",
"\"",
"\"",
")",
"||",
"strings",
".",
"HasPrefix",
"(",
"url",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // IsSSHURL returns true if supplied URL is SSH URL | [
"IsSSHURL",
"returns",
"true",
"if",
"supplied",
"URL",
"is",
"SSH",
"URL"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/git/git.go#L63-L65 |
161,787 | argoproj/argo-cd | pkg/client/informers/externalversions/application/v1alpha1/appproject.go | NewAppProjectInformer | func NewAppProjectInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredAppProjectInformer(client, namespace, resyncPeriod, indexers, nil)
} | go | func NewAppProjectInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredAppProjectInformer(client, namespace, resyncPeriod, indexers, nil)
} | [
"func",
"NewAppProjectInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"cache",
".",
"Indexers",
")",
"cache",
".",
"SharedIndexInformer",
"{",
"return",
"NewFiltere... | // NewAppProjectInformer constructs a new informer for AppProject type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. | [
"NewAppProjectInformer",
"constructs",
"a",
"new",
"informer",
"for",
"AppProject",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
".",
"This"... | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/informers/externalversions/application/v1alpha1/appproject.go#L34-L36 |
161,788 | argoproj/argo-cd | server/version/version.pb.gw.go | RegisterVersionServiceHandler | func RegisterVersionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterVersionServiceHandlerClient(ctx, mux, NewVersionServiceClient(conn))
} | go | func RegisterVersionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterVersionServiceHandlerClient(ctx, mux, NewVersionServiceClient(conn))
} | [
"func",
"RegisterVersionServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterVersionServiceHandlerClient",
"(",
"ctx",
",",
"mux",
... | // RegisterVersionServiceHandler registers the http handlers for service VersionService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterVersionServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"VersionService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/version/version.pb.gw.go#L68-L70 |
161,789 | argoproj/argo-cd | util/db/helmrepository.go | ListHelmRepos | func (db *db) ListHelmRepos(ctx context.Context) ([]*appv1.HelmRepository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
repos := make([]*appv1.HelmRepository, len(s.HelmRepositories))
for i, helmRepoInfo := range s.HelmRepositories {
repo, err := db.getHelmRepo(ctx, helmRe... | go | func (db *db) ListHelmRepos(ctx context.Context) ([]*appv1.HelmRepository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
repos := make([]*appv1.HelmRepository, len(s.HelmRepositories))
for i, helmRepoInfo := range s.HelmRepositories {
repo, err := db.getHelmRepo(ctx, helmRe... | [
"func",
"(",
"db",
"*",
"db",
")",
"ListHelmRepos",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"*",
"appv1",
".",
"HelmRepository",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"db",
".",
"settingsMgr",
".",
"GetSettings",
"(",
")... | // ListHelmRepoURLs lists configured helm repositories | [
"ListHelmRepoURLs",
"lists",
"configured",
"helm",
"repositories"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/helmrepository.go#L53-L68 |
161,790 | argoproj/argo-cd | server/project/project.pb.gw.go | RegisterProjectServiceHandler | func RegisterProjectServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterProjectServiceHandlerClient(ctx, mux, NewProjectServiceClient(conn))
} | go | func RegisterProjectServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterProjectServiceHandlerClient(ctx, mux, NewProjectServiceClient(conn))
} | [
"func",
"RegisterProjectServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterProjectServiceHandlerClient",
"(",
"ctx",
",",
"mux",
... | // RegisterProjectServiceHandler registers the http handlers for service ProjectService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterProjectServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"ProjectService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.pb.gw.go#L291-L293 |
161,791 | argoproj/argo-cd | controller/cache/cluster.go | startMissingWatches | func (c *clusterInfo) startMissingWatches() error {
apis, err := c.kubectl.GetAPIResources(c.cluster.RESTConfig(), c.settings)
if err != nil {
return err
}
for i := range apis {
api := apis[i]
if _, ok := c.apisMeta[api.GroupKind]; !ok {
ctx, cancel := context.WithCancel(context.Background())
info := ... | go | func (c *clusterInfo) startMissingWatches() error {
apis, err := c.kubectl.GetAPIResources(c.cluster.RESTConfig(), c.settings)
if err != nil {
return err
}
for i := range apis {
api := apis[i]
if _, ok := c.apisMeta[api.GroupKind]; !ok {
ctx, cancel := context.WithCancel(context.Background())
info := ... | [
"func",
"(",
"c",
"*",
"clusterInfo",
")",
"startMissingWatches",
"(",
")",
"error",
"{",
"apis",
",",
"err",
":=",
"c",
".",
"kubectl",
".",
"GetAPIResources",
"(",
"c",
".",
"cluster",
".",
"RESTConfig",
"(",
")",
",",
"c",
".",
"settings",
")",
"\... | // startMissingWatches lists supported cluster resources and start watching for changes unless watch is already running | [
"startMissingWatches",
"lists",
"supported",
"cluster",
"resources",
"and",
"start",
"watching",
"for",
"changes",
"unless",
"watch",
"is",
"already",
"running"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/cache/cluster.go#L169-L186 |
161,792 | argoproj/argo-cd | server/cluster/cluster.go | NewServer | func NewServer(db db.ArgoDB, enf *rbac.Enforcer, cache *cache.Cache) *Server {
return &Server{
db: db,
enf: enf,
cache: cache,
}
} | go | func NewServer(db db.ArgoDB, enf *rbac.Enforcer, cache *cache.Cache) *Server {
return &Server{
db: db,
enf: enf,
cache: cache,
}
} | [
"func",
"NewServer",
"(",
"db",
"db",
".",
"ArgoDB",
",",
"enf",
"*",
"rbac",
".",
"Enforcer",
",",
"cache",
"*",
"cache",
".",
"Cache",
")",
"*",
"Server",
"{",
"return",
"&",
"Server",
"{",
"db",
":",
"db",
",",
"enf",
":",
"enf",
",",
"cache",... | // NewServer returns a new instance of the Cluster service | [
"NewServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Cluster",
"service"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/cluster/cluster.go#L34-L40 |
161,793 | argoproj/argo-cd | server/cluster/cluster.go | List | func (s *Server) List(ctx context.Context, q *ClusterQuery) (*appv1.ClusterList, error) {
clusterList, err := s.db.ListClusters(ctx)
if err != nil {
return nil, err
}
clustersByServer := make(map[string][]appv1.Cluster)
for _, clust := range clusterList.Items {
if s.enf.Enforce(ctx.Value("claims"), rbacpolicy.... | go | func (s *Server) List(ctx context.Context, q *ClusterQuery) (*appv1.ClusterList, error) {
clusterList, err := s.db.ListClusters(ctx)
if err != nil {
return nil, err
}
clustersByServer := make(map[string][]appv1.Cluster)
for _, clust := range clusterList.Items {
if s.enf.Enforce(ctx.Value("claims"), rbacpolicy.... | [
"func",
"(",
"s",
"*",
"Server",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ClusterQuery",
")",
"(",
"*",
"appv1",
".",
"ClusterList",
",",
"error",
")",
"{",
"clusterList",
",",
"err",
":=",
"s",
".",
"db",
".",
"ListClust... | // List returns list of clusters | [
"List",
"returns",
"list",
"of",
"clusters"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/cluster/cluster.go#L76-L112 |
161,794 | argoproj/argo-cd | server/cluster/cluster.go | Get | func (s *Server) Get(ctx context.Context, q *ClusterQuery) (*appv1.Cluster, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionGet, q.Server); err != nil {
return nil, err
}
clust, err := s.db.GetCluster(ctx, q.Server)
return redact(clust), err
} | go | func (s *Server) Get(ctx context.Context, q *ClusterQuery) (*appv1.Cluster, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionGet, q.Server); err != nil {
return nil, err
}
clust, err := s.db.GetCluster(ctx, q.Server)
return redact(clust), err
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ClusterQuery",
")",
"(",
"*",
"appv1",
".",
"Cluster",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr",
"(",
"ctx",
... | // Get returns a cluster from a query | [
"Get",
"returns",
"a",
"cluster",
"from",
"a",
"query"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/cluster/cluster.go#L195-L201 |
161,795 | argoproj/argo-cd | server/cluster/cluster.go | Update | func (s *Server) Update(ctx context.Context, q *ClusterUpdateRequest) (*appv1.Cluster, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionUpdate, q.Cluster.Server); err != nil {
return nil, err
}
err := kube.TestConfig(q.Cluster.RESTConfig())
if err != nil {
r... | go | func (s *Server) Update(ctx context.Context, q *ClusterUpdateRequest) (*appv1.Cluster, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionUpdate, q.Cluster.Server); err != nil {
return nil, err
}
err := kube.TestConfig(q.Cluster.RESTConfig())
if err != nil {
r... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ClusterUpdateRequest",
")",
"(",
"*",
"appv1",
".",
"Cluster",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr",
"("... | // Update updates a cluster | [
"Update",
"updates",
"a",
"cluster"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/cluster/cluster.go#L204-L214 |
161,796 | argoproj/argo-cd | hack/update-openapi-validation/main.go | main | func main() {
if len(os.Args) != 3 {
log.Fatalf("Usage: %s CRDSPEC TYPE", os.Args[0])
}
crdPath := os.Args[1]
typePath := os.Args[2]
data, err := ioutil.ReadFile(crdPath)
if err != nil {
log.Fatal(err)
}
var crd apiextensions.CustomResourceDefinition
err = yaml.Unmarshal(data, &crd)
if err != nil {
log... | go | func main() {
if len(os.Args) != 3 {
log.Fatalf("Usage: %s CRDSPEC TYPE", os.Args[0])
}
crdPath := os.Args[1]
typePath := os.Args[2]
data, err := ioutil.ReadFile(crdPath)
if err != nil {
log.Fatal(err)
}
var crd apiextensions.CustomResourceDefinition
err = yaml.Unmarshal(data, &crd)
if err != nil {
log... | [
"func",
"main",
"(",
")",
"{",
"if",
"len",
"(",
"os",
".",
"Args",
")",
"!=",
"3",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"os",
".",
"Args",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"crdPath",
":=",
"os",
".",
"Args",
"[",
"1",
"]"... | // Generate OpenAPI spec definitions for Rollout Resource | [
"Generate",
"OpenAPI",
"spec",
"definitions",
"for",
"Rollout",
"Resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/hack/update-openapi-validation/main.go#L18-L63 |
161,797 | argoproj/argo-cd | pkg/apiclient/apiclient.go | NewClient | func NewClient(opts *ClientOptions) (Client, error) {
var c client
localCfg, err := localconfig.ReadLocalConfig(opts.ConfigPath)
if err != nil {
return nil, err
}
c.proxyMutex = &sync.Mutex{}
var ctxName string
if localCfg != nil {
configCtx, err := localCfg.ResolveContext(opts.Context)
if err != nil {
... | go | func NewClient(opts *ClientOptions) (Client, error) {
var c client
localCfg, err := localconfig.ReadLocalConfig(opts.ConfigPath)
if err != nil {
return nil, err
}
c.proxyMutex = &sync.Mutex{}
var ctxName string
if localCfg != nil {
configCtx, err := localCfg.ResolveContext(opts.Context)
if err != nil {
... | [
"func",
"NewClient",
"(",
"opts",
"*",
"ClientOptions",
")",
"(",
"Client",
",",
"error",
")",
"{",
"var",
"c",
"client",
"\n",
"localCfg",
",",
"err",
":=",
"localconfig",
".",
"ReadLocalConfig",
"(",
"opts",
".",
"ConfigPath",
")",
"\n",
"if",
"err",
... | // NewClient creates a new API client from a set of config options. | [
"NewClient",
"creates",
"a",
"new",
"API",
"client",
"from",
"a",
"set",
"of",
"config",
"options",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apiclient/apiclient.go#L112-L193 |
161,798 | argoproj/argo-cd | pkg/apiclient/apiclient.go | OIDCConfig | func (c *client) OIDCConfig(ctx context.Context, set *settings.Settings) (*oauth2.Config, *oidc.Provider, error) {
var clientID string
var issuerURL string
if set.DexConfig != nil && len(set.DexConfig.Connectors) > 0 {
clientID = common.ArgoCDCLIClientAppID
issuerURL = fmt.Sprintf("%s%s", set.URL, common.DexAPIE... | go | func (c *client) OIDCConfig(ctx context.Context, set *settings.Settings) (*oauth2.Config, *oidc.Provider, error) {
var clientID string
var issuerURL string
if set.DexConfig != nil && len(set.DexConfig.Connectors) > 0 {
clientID = common.ArgoCDCLIClientAppID
issuerURL = fmt.Sprintf("%s%s", set.URL, common.DexAPIE... | [
"func",
"(",
"c",
"*",
"client",
")",
"OIDCConfig",
"(",
"ctx",
"context",
".",
"Context",
",",
"set",
"*",
"settings",
".",
"Settings",
")",
"(",
"*",
"oauth2",
".",
"Config",
",",
"*",
"oidc",
".",
"Provider",
",",
"error",
")",
"{",
"var",
"clie... | // OIDCConfig returns OAuth2 client config and a OpenID Provider based on Argo CD settings
// ctx can hold an appropriate http.Client to use for the exchange | [
"OIDCConfig",
"returns",
"OAuth2",
"client",
"config",
"and",
"a",
"OpenID",
"Provider",
"based",
"on",
"Argo",
"CD",
"settings",
"ctx",
"can",
"hold",
"an",
"appropriate",
"http",
".",
"Client",
"to",
"use",
"for",
"the",
"exchange"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apiclient/apiclient.go#L197-L223 |
161,799 | argoproj/argo-cd | pkg/apiclient/apiclient.go | HTTPClient | func (c *client) HTTPClient() (*http.Client, error) {
tlsConfig, err := c.tlsConfig()
if err != nil {
return nil, err
}
return &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepA... | go | func (c *client) HTTPClient() (*http.Client, error) {
tlsConfig, err := c.tlsConfig()
if err != nil {
return nil, err
}
return &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepA... | [
"func",
"(",
"c",
"*",
"client",
")",
"HTTPClient",
"(",
")",
"(",
"*",
"http",
".",
"Client",
",",
"error",
")",
"{",
"tlsConfig",
",",
"err",
":=",
"c",
".",
"tlsConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"e... | // HTTPClient returns a HTTPClient appropriate for performing OAuth, based on TLS settings | [
"HTTPClient",
"returns",
"a",
"HTTPClient",
"appropriate",
"for",
"performing",
"OAuth",
"based",
"on",
"TLS",
"settings"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apiclient/apiclient.go#L226-L243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.