├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── ---bug-report.md │ ├── config.yml │ ├── custom.md │ └── feature_request.md └── workflows │ ├── codeql-analysis.yml │ ├── integration-tests.yml │ ├── release.yml │ └── skip-test.yml ├── .gitignore ├── .goreleaser.yml ├── CODEOWNERS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── api ├── action_template.json ├── action_template_example.json ├── action_template_parameter.json ├── octopus_deploy.json ├── package_reference.json ├── property_value.json ├── space.json ├── spec.json ├── tenant-resource-example.json ├── tenant-resource.json └── user.json ├── examples ├── accounts │ ├── create_amazon_web_services_account.go │ ├── create_azure_oidc.go │ ├── create_azure_service_principal.go │ ├── create_azure_subscription_account.go │ ├── create_ssh_key_account.go │ ├── create_token_account.go │ ├── create_username_password.go │ ├── delete_account.go │ └── get_account_by_id.go ├── action_templates │ └── delete_action_template.go ├── artifacts │ ├── delete_artifact.go │ └── get_artifact_by_id.go ├── build_information │ └── delete_build_information.go ├── certificates │ ├── create_certificate.go │ ├── delete_certificate.go │ ├── get_certificate_by_id.go │ └── replace_certificate.go ├── channels │ ├── delete_channel.go │ └── get_channel_by_id.go ├── deployment_processes │ ├── add_environment_condition_to_step.go │ ├── create_script_step.go │ ├── get_deployment_process_by_id.go │ ├── get_steps_using_package.go │ └── get_steps_using_role.go ├── deployments │ ├── delete_deployment.go │ └── get_deployment_by_id.go ├── environments │ ├── delete_environment.go │ └── get_environment_by_id.go ├── feeds │ ├── change_feed.go │ ├── create_feed.go │ ├── delete_feed.go │ ├── get_all_feeds.go │ └── get_feed_by_id.go ├── library_variable_sets │ ├── delete_library_variable_set.go │ └── get_library_variable_set_by_id.go ├── lifecycles │ ├── create_lifecycle.go │ ├── delete_lifecycle.go │ ├── get_lifecycle_by_id.go │ └── update_lifecycle.go ├── machine_policies │ └── delete_machine_policy.go ├── machines │ ├── delete_machine.go │ └── get_machine_by_id.go ├── octopus_server_nodes │ └── delete_octopus_server_node.go ├── packages │ ├── delete_package.go │ └── get_package_by_id.go ├── project_groups │ └── delete_project_group.go ├── project_triggers │ └── delete_project_trigger.go ├── projects │ ├── create_project.go │ ├── delete_project.go │ ├── get_project_by_id.go │ └── update_project.go ├── proxies │ └── delete_proxy.go ├── releases │ ├── delete_release.go │ └── get_release_by_id.go ├── runbook_runs │ └── delete_runbook_run.go ├── runbook_snapshots │ ├── create_runbook_snapshot.go │ └── delete_runbook_snapshot.go ├── runbooks │ ├── create_runbook.go │ ├── delete_runbook.go │ └── get_runbook_by_id.go ├── scoped_user_roles │ └── delete_scoped_user_role.go ├── spaces │ ├── create_space.go │ ├── delete_space.go │ └── get_space_by_id.go ├── subscriptions │ └── delete_subscription.go ├── tag_sets │ └── delete_tag_set.go ├── teams │ ├── create_team.go │ └── delete_team.go ├── tenants │ └── delete_tenant.go ├── user_roles │ └── delete_user_role.go ├── users │ └── delete_user.go ├── worker_pools │ └── delete_worker_pool.go └── workers │ └── delete_worker.go ├── go.mod ├── go.sum ├── internal ├── errors.go ├── extensions │ ├── change_control_extension_settings.go │ ├── connected_change_control_extension_settings.go │ └── extension_settings.go ├── json.go ├── links.go ├── types.go ├── util_test.go ├── utilities.go └── validation.go ├── pkg ├── accounts │ ├── account.go │ ├── account_resource.go │ ├── account_resource_test.go │ ├── account_service.go │ ├── account_service_test.go │ ├── account_test.go │ ├── account_types.go │ ├── account_usage.go │ ├── account_utilities.go │ ├── account_utilities_test.go │ ├── accounts.go │ ├── accounts_query.go │ ├── amazon_web_services_account.go │ ├── amazon_web_services_account_test.go │ ├── aws_oidc_account.go │ ├── aws_oidc_account_test.go │ ├── azure │ │ └── azurewebapp.go │ ├── azure_oidc_account.go │ ├── azure_oidc_account_test.go │ ├── azure_service_principal_account.go │ ├── azure_service_principal_account_test.go │ ├── azure_subscription_account.go │ ├── azure_subscription_account_test.go │ ├── generic_oidc_account.go │ ├── generic_oidc_account_test.go │ ├── google_cloud_platform_account.go │ ├── is_nil.go │ ├── queries_test.go │ ├── ssh_key_account.go │ ├── ssh_key_account_test.go │ ├── target_usage_entry.go │ ├── token_account.go │ ├── token_account_test.go │ ├── username_password_account.go │ └── username_password_account_test.go ├── actions │ ├── action_type.go │ ├── action_type_string.go │ ├── auto_deploy_action.go │ ├── community_action_template.go │ ├── community_action_template_service.go │ ├── community_action_template_service_test.go │ ├── community_action_templates_query.go │ ├── create_release_action.go │ ├── deploy_latest_release_action.go │ ├── deploy_new_release_action.go │ ├── is_nil.go │ ├── json.go │ ├── project_trigger_action.go │ ├── run_runbook_action.go │ ├── scoped_deployment_action.go │ ├── trigger_action.go │ └── version_control_reference.go ├── actiontemplates │ ├── action_template.go │ ├── action_template_category.go │ ├── action_template_logo_query.go │ ├── action_template_parameter.go │ ├── action_template_search.go │ ├── action_template_service.go │ ├── action_template_service_test.go │ ├── action_template_versioned_logo_query.go │ ├── is_nil.go │ └── query.go ├── artifacts │ ├── artifact.go │ ├── artifact_service.go │ ├── is_nil.go │ └── query.go ├── authentication │ ├── authentication.go │ ├── authentication_provider_element.go │ ├── authentication_service.go │ ├── authentication_service_test.go │ └── is_nil.go ├── azure │ ├── azure_environment_service.go │ ├── azure_environment_service_test.go │ └── devops │ │ └── azure_devops_connectivity_check_service.go ├── buildinformation │ ├── build_information.go │ ├── build_information_bulk_query.go │ ├── build_information_query.go │ ├── build_information_service.go │ ├── build_information_service_test.go │ ├── is_nil.go │ └── overwrite_mode.go ├── certificates │ ├── certificate.go │ ├── certificate_service.go │ ├── certificate_service_test.go │ ├── certificates_query.go │ ├── is_nil.go │ └── replacement_certificate.go ├── channels │ ├── channel.go │ ├── channel_git_resource_rule.go │ ├── channel_rule.go │ ├── channel_service.go │ ├── channel_service_test.go │ ├── is_nil.go │ ├── query.go │ └── version_rule_test_query.go ├── client │ ├── api_key_test.go │ ├── client_test.go │ ├── is_nil.go │ ├── octopusdeploy.go │ ├── root_resource.go │ ├── root_service.go │ ├── root_service_test.go │ └── test_helpers.go ├── cloudtemplate │ ├── cloud_template_query.go │ └── cloud_template_service.go ├── configuration │ ├── certificate_configuration_query.go │ ├── certificate_configuration_service.go │ ├── configuration_section.go │ ├── configuration_service.go │ ├── configuration_service_test.go │ ├── feature_toggle_configuration.go │ ├── feature_toggle_configuration_service.go │ ├── features_configuration.go │ ├── is_nil.go │ ├── lets_encrypt_configuration_service.go │ ├── maintenance_configuration_service.go │ ├── performance_configuration_service.go │ ├── server_configuration_service.go │ ├── smtp_configuration_service.go │ └── upgrade_configuration_service.go ├── constants │ ├── constants_action_types.go │ ├── constants_api_replies.go │ ├── constants_client.go │ ├── constants_links.go │ ├── constants_operations.go │ ├── constants_parameters.go │ ├── constants_services.go │ └── constants_uri_templates.go ├── core │ ├── api_error.go │ ├── connectivity_check.go │ ├── connectivity_policy.go │ ├── deployment_mode_types.go │ ├── named_reference_item.go │ ├── property_value.go │ ├── retention_period.go │ ├── sensitive_value.go │ ├── sensitive_value_test.go │ ├── skip_machine_behavior.go │ ├── skip_take_query.go │ └── work_item_link.go ├── credentials │ ├── anonymous.go │ ├── anonymous_test.go │ ├── git_credential.go │ ├── is_nil.go │ ├── query.go │ ├── reference.go │ ├── reference_test.go │ ├── resource.go │ ├── resource_test.go │ ├── service.go │ ├── service_test.go │ ├── types.go │ └── username_password.go ├── dashboard │ ├── dashboard_configuration_service.go │ ├── dashboard_dynamic_query.go │ ├── dashboard_item.go │ ├── dashboard_query.go │ └── dashboard_service.go ├── defects │ ├── defect.go │ ├── defect_service.go │ └── defect_test.go ├── deploymentfreezes │ ├── deploymentfreeze.go │ ├── deploymentfreeze_query.go │ ├── deploymentfreeze_service_test.go │ └── deploymentfreezes_service.go ├── deployments │ ├── channel_rule.go │ ├── deploy_release_v1.go │ ├── deployment.go │ ├── deployment_action.go │ ├── deployment_action_container.go │ ├── deployment_preview.go │ ├── deployment_process.go │ ├── deployment_process_service.go │ ├── deployment_process_service_test.go │ ├── deployment_process_template.go │ ├── deployment_process_test.go │ ├── deployment_processes_query.go │ ├── deployment_query.go │ ├── deployment_service.go │ ├── deployment_service_test.go │ ├── deployment_settings.go │ ├── deployment_step.go │ ├── deployment_step_condition_types.go │ ├── deployment_step_package_requirement.go │ ├── deployment_step_start_trigger.go │ ├── deployments_query.go │ ├── is_nil.go │ ├── step_usage.go │ └── step_usage_entry.go ├── environments │ ├── environment.go │ ├── environment_service.go │ ├── environment_service_test.go │ ├── environment_test.go │ ├── environments_query.go │ ├── environments_summary_query.go │ ├── is_nil.go │ ├── jira_extension_settings.go │ ├── jira_service_management_extension_settings.go │ └── servicenow_extension_settings.go ├── events │ ├── change_details.go │ ├── document_type.go │ ├── event.go │ ├── event_agent.go │ ├── event_categories_query.go │ ├── event_category.go │ ├── event_group.go │ ├── event_groups_query.go │ ├── event_reference.go │ ├── event_service.go │ └── events_query.go ├── extensions │ ├── dynamic_extension_service.go │ ├── extension_identifiers.go │ ├── extension_settings.go │ └── extension_settings_test.go ├── externalsecuritygroupproviders │ └── external_security_group_provider_service.go ├── feeds │ ├── artifactory_generic.go │ ├── aws_elastic_container_registry.go │ ├── azure_container_registry.go │ ├── built_in_feed.go │ ├── built_in_feed_statistics.go │ ├── docker_container_registry.go │ ├── feed.go │ ├── feed_resource.go │ ├── feed_service.go │ ├── feed_service_test.go │ ├── feed_types.go │ ├── feed_utilities.go │ ├── feed_utilities_test.go │ ├── feeds_query.go │ ├── github_feed.go │ ├── google_container_registry.go │ ├── helm_feed.go │ ├── is_nil.go │ ├── maven_feed.go │ ├── nuget_feed.go │ ├── oci_registry_feed.go │ ├── octopus_project_feed.go │ ├── s3_bucket.go │ ├── search_package_versions_query.go │ └── search_packages_query.go ├── filters │ ├── continuous_daily_scheduled_trigger_filter.go │ ├── cron_scheduled_trigger_filter.go │ ├── daily_scheduled_trigger_filter.go │ ├── daily_scheduled_trigger_interval.go │ ├── daily_scheduled_trigger_interval_string.go │ ├── date_of_month_scheduled_trigger_filter.go │ ├── days_per_month_scheduled_trigger_filter.go │ ├── deployment_target_filter.go │ ├── feed_trigger_filter.go │ ├── filter_type.go │ ├── filter_type_string.go │ ├── git_trigger_filter.go │ ├── json.go │ ├── monthly_schedule.go │ ├── monthly_schedule_string.go │ ├── once_daily_scheduled_trigger_filter.go │ ├── project_trigger_filter.go │ ├── schedule_trigger_filter.go │ ├── scheduled_trigger_filter.go │ ├── scheduled_trigger_filter_run_type.go │ ├── scheduled_trigger_filter_run_type_string.go │ ├── trigger_filter.go │ ├── weekday.go │ └── weekday_string.go ├── gitdependencies │ ├── deployment_action_git_dependency.go │ ├── git_dependency.go │ └── selected_git_reference.go ├── interruptions │ ├── control.go │ ├── form.go │ ├── form_element.go │ ├── interruption.go │ ├── interruption_service.go │ ├── interruption_service_test.go │ ├── interruption_submit_request.go │ ├── interruptions_query.go │ └── is_nil.go ├── invitations │ └── invitation_service.go ├── issuetrackers │ ├── commit.go │ ├── commit_details.go │ ├── issue_tracker_service.go │ └── issue_trackers_query.go ├── jira │ └── jira_integration_service.go ├── libraryvariablesets │ └── library_variable_set_service.go ├── licenses │ └── licenses_service.go ├── lifecycles │ ├── is_nil.go │ ├── lifecycle.go │ ├── lifecycle_service.go │ ├── lifecycle_service_test.go │ ├── lifecycle_test.go │ ├── phase.go │ └── query.go ├── machinepolicies │ ├── duration_formatter.go │ ├── machine_cleanup_policy.go │ ├── machine_connectivity_policy.go │ ├── machine_health_check_policy.go │ ├── machine_package_cache_retention_policy.go │ ├── machine_policies_query.go │ ├── machine_policy.go │ ├── machine_policy_service.go │ ├── machine_script_policy.go │ └── machine_update_policy.go ├── machines │ ├── activity_log_element.go │ ├── activity_log_entry.go │ ├── azure_cloud_service_endpoint.go │ ├── azure_service_fabric_endpoint.go │ ├── azure_web_app_endpoint.go │ ├── cloud_region_endpoint.go │ ├── cloud_service_endpoint.go │ ├── deployment_target.go │ ├── discover_machine_query.go │ ├── discover_worker_query.go │ ├── duration_formatter.go │ ├── duration_formatter_test.go │ ├── endpoint.go │ ├── endpoint_resource.go │ ├── endpoint_test.go │ ├── endpoint_utilities.go │ ├── endpoint_with_account.go │ ├── endpoint_with_proxy.go │ ├── get_random_duration.go │ ├── is_nil.go │ ├── kubernetes_agent_details.go │ ├── kubernetes_authentication.go │ ├── kubernetes_aws_authentication.go │ ├── kubernetes_azure_authentication.go │ ├── kubernetes_certificate_authentication.go │ ├── kubernetes_endpoint.go │ ├── kubernetes_endpoint_test.go │ ├── kubernetes_gcp_authentication.go │ ├── kubernetes_pod_authentication.go │ ├── kubernetes_standard_authentication.go │ ├── kubernetes_tentacle_endpoint.go │ ├── listening_tentacle_deployment_target.go │ ├── listening_tentacle_endpoint.go │ ├── listening_tentacle_endpoint_test.go │ ├── machine.go │ ├── machine_cleanup_policy.go │ ├── machine_connection_status.go │ ├── machine_connectivity_policy.go │ ├── machine_health_check_policy.go │ ├── machine_package-cache_retention_policy.go │ ├── machine_policies_query.go │ ├── machine_policy.go │ ├── machine_policy_service.go │ ├── machine_policy_service_test.go │ ├── machine_role_service.go │ ├── machine_script_policy.go │ ├── machine_service.go │ ├── machine_service_test.go │ ├── machine_tentacle_version_details.go │ ├── machine_test.go │ ├── machine_update_policy.go │ ├── machines_query.go │ ├── offline_package_drop_deployment_target.go │ ├── offline_package_drop_destination.go │ ├── offline_package_drop_endpoint.go │ ├── polling_tentacle_endpoint.go │ ├── runs_on_a_worker.go │ ├── ssh_endpoint.go │ ├── ssh_endpoint_test.go │ ├── tentacle_endpoint.go │ ├── tentacle_endpoint_configuration.go │ ├── tentacle_version_details.go │ ├── valid_values.go │ ├── worker.go │ ├── worker_service.go │ ├── worker_service_test.go │ ├── worker_test.go │ └── workers_query.go ├── metadata │ ├── display_info.go │ ├── list_api_metadata.go │ ├── metadata.go │ ├── options_metadata.go │ ├── property_applicability.go │ ├── property_metadata.go │ └── type_metadata.go ├── migrations │ └── migration_service.go ├── newclient │ ├── client.go │ ├── crud.go │ └── httpsession.go ├── octopusservernodes │ ├── octopus_server_node.go │ ├── octopus_server_nodes_query.go │ └── octopus_server_nodes_service.go ├── packages │ ├── deployment_action_package.go │ ├── deployment_action_slug_package.go │ ├── is_nil.go │ ├── multipartstreaming.go │ ├── multipartstreaming_test.go │ ├── octopus_package_metadata_service.go │ ├── overwrite_mode.go │ ├── package.go │ ├── package_delta_signature_query.go │ ├── package_delta_upload.go │ ├── package_delta_upload_query.go │ ├── package_description.go │ ├── package_metadata_query.go │ ├── package_metadata_service.go │ ├── package_note.go │ ├── package_notes_list_query.go │ ├── package_notes_result.go │ ├── package_reference.go │ ├── package_service.go │ ├── package_service_test.go │ ├── package_upload.go │ ├── package_upload_query.go │ ├── package_upload_v2.go │ ├── package_version.go │ ├── packages_bulk_query.go │ ├── packages_query.go │ └── selected_package.go ├── permissions │ ├── permission_description.go │ ├── permission_service.go │ ├── projected_team_reference_data_item.go │ ├── space_permissions.go │ ├── user_permission_restriction.go │ └── user_permission_set.go ├── projectbranches │ └── project_branches_service.go ├── projectgroups │ ├── is_nil.go │ ├── project_group.go │ ├── project_group_service.go │ ├── project_group_service_test.go │ └── project_groups_query.go ├── projects │ ├── auto_deploy_release_override.go │ ├── conversion_state.go │ ├── convert_to_vcs.go │ ├── convert_to_vcs_response.go │ ├── database_persistence_settings.go │ ├── git_persistence_settings.go │ ├── git_persistence_settings_test.go │ ├── is_nil.go │ ├── jira_service_management_extension_settings.go │ ├── jira_service_management_extension_settings_test.go │ ├── persistence_settings.go │ ├── persistence_settings_types.go │ ├── progression.go │ ├── project.go │ ├── project_branches.go │ ├── project_clone_request.go │ ├── project_pulse_query.go │ ├── project_service.go │ ├── project_service_git_refs.go │ ├── project_service_git_refs_test.go │ ├── project_service_test.go │ ├── project_summary.go │ ├── project_test.go │ ├── projects_experimental_summaries_query.go │ ├── projects_query.go │ ├── release_creation_strategy.go │ ├── servicenow_extension_settings.go │ ├── servicenow_extension_settings_test.go │ └── versioning_strategy.go ├── projectvariables │ └── project_variables_service.go ├── proxies │ ├── proxies_query.go │ ├── proxy.go │ └── proxy_service.go ├── releases │ ├── create_release_v1.go │ ├── is_nil.go │ ├── missing_package_info.go │ ├── progression.go │ ├── release.go │ ├── release_changes.go │ ├── release_package_version_build_information.go │ ├── release_query.go │ ├── release_service.go │ ├── release_template_git_resource.go │ ├── release_template_package.go │ ├── release_usage.go │ ├── release_usage_entry.go │ └── releases_query.go ├── reporting │ └── reporting_service.go ├── resources │ ├── display_settings.go │ ├── interfaces.go │ ├── links.go │ ├── paged_results.go │ ├── process_reference_data_item.go │ ├── reference_data_item.go │ ├── resource.go │ ├── resource_test.go │ └── resources.go ├── runbookprocess │ ├── runbook_process.go │ └── runbook_process_service.go ├── runbooks │ ├── is_nil.go │ ├── run_git_runbook_v1.go │ ├── run_preview.go │ ├── run_runbook_v1.go │ ├── runbook.go │ ├── runbook_process.go │ ├── runbook_process_service.go │ ├── runbook_process_service_test.go │ ├── runbook_processes_query.go │ ├── runbook_retention_period.go │ ├── runbook_run_service.go │ ├── runbook_runs_query.go │ ├── runbook_service.go │ ├── runbook_service_test.go │ ├── runbook_snapshot.go │ ├── runbook_snapshot_query.go │ ├── runbook_snapshot_service.go │ ├── runbook_snapshot_service_test.go │ ├── runbook_snapshot_template.go │ ├── runbook_snapshot_usage.go │ ├── runbook_snapshot_usage_entry.go │ ├── runbook_step_usage.go │ └── runbooks_query.go ├── scheduler │ ├── scheduler_query.go │ └── scheduler_service.go ├── scriptmodules │ └── script_module_service.go ├── serverstatus │ ├── server_status.go │ └── server_status_service.go ├── serviceaccounts │ └── oidc_identities.go ├── services │ ├── api │ │ ├── api.go │ │ ├── automation_environment_provider.go │ │ ├── automation_environment_provider_test.go │ │ └── environment.go │ ├── is_nil.go │ ├── new_service_tests.go │ └── service.go ├── spaces │ ├── is_nil.go │ ├── space.go │ ├── space_home_query.go │ ├── space_service.go │ ├── space_service_test.go │ └── spaces_query.go ├── subscriptions │ ├── subscription_service.go │ └── subscriptions_query.go ├── tagsets │ ├── is_nil.go │ ├── tag.go │ ├── tag_set.go │ ├── tag_set_service.go │ ├── tag_set_service_test.go │ └── tag_sets_query.go ├── tasks │ ├── is_nil.go │ ├── task.go │ ├── task_detail.go │ ├── task_service.go │ └── tasks_query.go ├── teammembership │ └── team_membership_service.go ├── teams │ ├── is_nil.go │ ├── team.go │ ├── team_membership_query.go │ ├── team_service.go │ ├── team_service_test.go │ └── teams_query.go ├── tenants │ ├── is_nil.go │ ├── tenant.go │ ├── tenant_clone_request.go │ ├── tenant_service.go │ ├── tenant_service_test.go │ ├── tenant_variables_query.go │ ├── tenants_missing_variables_query.go │ └── tenants_query.go ├── triggers │ ├── is_nil.go │ ├── project_trigger.go │ ├── project_trigger_service.go │ ├── project_trigger_service_test.go │ ├── project_trigger_test.go │ ├── project_triggers_query.go │ ├── scheduled_project_triggers_query.go │ └── scheduled_project_triggers_service.go ├── useronboarding │ └── user_onboarding_service.go ├── userroles │ ├── is_nil.go │ ├── scoped_user_role.go │ ├── scoped_user_role_service.go │ ├── scoped_user_role_service_test.go │ ├── scoped_user_roles_query.go │ ├── user_role.go │ ├── user_role_service.go │ └── user_roles_query.go ├── users │ ├── api_key.go │ ├── api_key_service.go │ ├── api_key_service_test.go │ ├── api_query.go │ ├── external_user_search_query.go │ ├── identity.go │ ├── identity_claim.go │ ├── is_nil.go │ ├── sign_in_query.go │ ├── user.go │ ├── user_authentication.go │ ├── user_query.go │ ├── user_service.go │ ├── user_service_test.go │ └── users_query.go ├── validation │ └── not_all_validator.go ├── variables │ ├── is_nil.go │ ├── library.go │ ├── library_variable.go │ ├── library_variable_set.go │ ├── library_variable_set_service.go │ ├── library_variable_set_service_test.go │ ├── library_variable_set_usage_entry.go │ ├── library_variables_query.go │ ├── missing_variable.go │ ├── missing_variables_query.go │ ├── project_variable.go │ ├── project_variable_set_usage.go │ ├── script_module.go │ ├── script_module_service.go │ ├── script_module_service_test.go │ ├── tenant_common_variable.go │ ├── tenant_project_variable.go │ ├── tenant_variable.go │ ├── tenant_variable_scope.go │ ├── tenant_variable_service.go │ ├── tenants_missing_variables.go │ ├── variable.go │ ├── variable_name_query.go │ ├── variable_preview_query.go │ ├── variable_prompt_options.go │ ├── variable_scope.go │ ├── variable_scope_values.go │ ├── variable_service.go │ ├── variable_service_test.go │ ├── variable_set.go │ └── variables_query.go ├── workerpools │ ├── dynamic_worker_pool.go │ ├── dynamic_worker_pool_type_resource.go │ ├── is_nil.go │ ├── static_worker_pool.go │ ├── worker_pool.go │ ├── worker_pool_resource.go │ ├── worker_pool_service.go │ ├── worker_pool_service_test.go │ ├── worker_pool_types.go │ ├── worker_pool_utilities.go │ ├── worker_pools_query.go │ └── worker_pools_summary_query.go ├── workers │ └── worker_service.go └── workertoolslatestimages │ └── worker_tools_latest_images_service.go ├── test ├── e2e │ ├── account_service_test.go │ ├── action_template_service_test.go │ ├── api_keys_test.go │ ├── artifact_service_test.go │ ├── build_information_test.go │ ├── certificate_service_test.go │ ├── channel_service_test.go │ ├── community_action_template_service_test.go │ ├── configuration_service_test.go │ ├── deployment_freeze_service_test.go │ ├── deployment_process_test.go │ ├── environment_service_test.go │ ├── event_service_test.go │ ├── feed_service_test.go │ ├── git_credential_service_test.go │ ├── interruption_test.go │ ├── library_variables_test.go │ ├── lifecycle_service_test.go │ ├── machine_service_test.go │ ├── package_service_test.go │ ├── project_group_service_test.go │ ├── project_service_test.go │ ├── project_test.go │ ├── project_trigger_test.go │ ├── release_service_test.go │ ├── root_test.go │ ├── runbook_service_test.go │ ├── runbook_snapshot_service_test.go │ ├── script_module_service_test.go │ ├── server_status_service_test.go │ ├── space_service_test.go │ ├── tag_service_test.go │ ├── tagset_service_test.go │ ├── task_service_test.go │ ├── team_service_test.go │ ├── tenant_service_test.go │ ├── tenant_variables_service_test.go │ ├── test_helpers.go │ ├── user_role_service_test.go │ ├── user_service_test.go │ ├── utilities.go │ ├── variable_service_test.go │ ├── worker_pool_service_test.go │ └── worker_service_test.go ├── resources │ ├── anonymous_git_credential_test.go │ ├── build_information_test.go │ ├── certificate_test.go │ ├── channel_test.go │ ├── deployment_action_test.go │ ├── deployment_target_test.go │ ├── display_settings_test.go │ ├── feed_utilities_test.go │ ├── machine_health_check_policy_test.go │ ├── not_all_validator_test.go │ ├── project_test.go │ ├── property_value_test.go │ ├── sensitive_value_test.go │ ├── task_test.go │ ├── username_password_git_credential_test.go │ └── variable_scope_test.go └── testutil.go ├── tests ├── Create-ApiKey.ps1 ├── Octopus.ps1 └── docker-compose.yml └── uritemplates ├── LICENSE ├── links.go ├── uritemplatecache.go └── uritemplates.go /.gitattributes: -------------------------------------------------------------------------------- 1 | # Force checkout line endings in Unix format - https://help.github.com/articles/dealing-with-line-endings/ 2 | * text eol=lf 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug Report" 3 | about: Report a reproducible bug or regression with go-octopusdeploy. 4 | title: "[BUG]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please provide all the information requested. Issues that do not follow this format are likely to stall. 11 | 12 | **Description** 13 | Please provide a clear and concise description of what the bug is. 14 | 15 | **Steps To Reproduce** 16 | Provide a detailed list of steps that reproduce the issue. 17 | 18 | 1. 19 | 2. 20 | 21 | **Expected Behavior** 22 | A clear and concise description of what you expected to happen. 23 | 24 | **Any Logs and/or Other Supporting Information** 25 | 26 | **Environment and/or Versions** 27 | - Octopus Server Version: [e.g. `2020.3.2`] 28 | - Go Version (`$ go version`): [e.g. `go version go1.15 darwin/amd64`] 29 | 30 | **Additional Context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | on: 3 | push: 4 | branches: [ main ] 5 | paths: 6 | - integration/** 7 | - octopusdeploy/** 8 | pull_request: 9 | jobs: 10 | analyze: 11 | name: Analyze 12 | runs-on: ubuntu-latest 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | language: [ 'go' ] 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v3 20 | - name: Initialize CodeQL 21 | uses: github/codeql-action/init@v2 22 | with: 23 | languages: ${{ matrix.language }} 24 | - name: Autobuild 25 | uses: github/codeql-action/autobuild@v2 26 | - name: Perform CodeQL Analysis 27 | uses: github/codeql-action/analyze@v2 28 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | tags: 5 | - "v*" 6 | jobs: 7 | goreleaser: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | with: 12 | fetch-depth: 0 13 | - uses: actions/setup-go@v3 14 | with: 15 | go-version: '>=1.18.0' 16 | - uses: goreleaser/goreleaser-action@v3 17 | with: 18 | args: release --clean 19 | version: latest 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | -------------------------------------------------------------------------------- /.github/workflows/skip-test.yml: -------------------------------------------------------------------------------- 1 | name: Skip Tests 2 | on: 3 | pull_request: 4 | path: 5 | - '**.md' 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - run: 'echo "No build required" ' 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Golang Debug 15 | debug 16 | integration/OFF/ 17 | vendor 18 | 19 | # Editors 20 | .atom/ 21 | .idea/ 22 | .vscode/ 23 | 24 | # Env Files 25 | .env 26 | 27 | go-octopusdeploy 28 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | before: 4 | hooks: 5 | - go mod tidy 6 | builds: 7 | - skip: true 8 | changelog: 9 | filters: 10 | exclude: 11 | - "^docs:" 12 | - "^test:" 13 | - "^README.md" 14 | - "^.goreleaser.yaml" 15 | groups: 16 | - title: 'New Features' 17 | regexp: "^.*feat[(\\w)]*:+.*$" 18 | order: 0 19 | - title: 'Breaking Changes' 20 | regexp: "^.*break[(\\w)]*:+.*$" 21 | order: 1 22 | - title: 'Bug Fixes' 23 | regexp: "^.*fix[(\\w)]*:+.*$" 24 | order: 10 25 | - title: Other Work 26 | order: 999 27 | sort: asc 28 | use: github -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | @octopusdeploy/team-integrations-fnm -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Octopus Deploy and contributors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. -------------------------------------------------------------------------------- /api/action_template_parameter.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://octopus.com/2020/package-reference.json", 4 | "title": "Package Reference", 5 | "description": "Represents a package reference", 6 | "type": "object", 7 | "properties": { 8 | "default_value": { 9 | "$ref": "property_value.json" 10 | }, 11 | "display_settings": { 12 | "type": "object", 13 | "additionalProperties": { 14 | "type": "string" 15 | } 16 | }, 17 | "help_text": { 18 | "type": "string" 19 | }, 20 | "id": { 21 | "description": "unique identifier of a package reference", 22 | "readOnly": true, 23 | "type": "string" 24 | }, 25 | "label": { 26 | "type": "string" 27 | }, 28 | "name": { 29 | "type": "string" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /api/package_reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://octopus.com/2020/package-reference.json", 4 | "title": "Package Reference", 5 | "description": "Represents a package reference", 6 | "type": "object", 7 | "properties": { 8 | "AcquisitionLocation": { 9 | "type": "string" 10 | }, 11 | "FeedID": { 12 | "type": "string" 13 | }, 14 | "ID": { 15 | "type": "string", 16 | "readOnly": true 17 | }, 18 | "PackageID": { 19 | "type": "string" 20 | }, 21 | "Name": { 22 | "type": "string" 23 | }, 24 | "Properties": { 25 | "type": "string" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /api/property_value.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://octopus.com/2020/property-value.json", 4 | "title": "Property Value", 5 | "description": "Represents a property value", 6 | "type": "object", 7 | "properties": { 8 | "IsSensitive": { 9 | "type": "boolean", 10 | "readOnly": true 11 | }, 12 | "Value": { 13 | "type": "string", 14 | "readOnly": true 15 | }, 16 | "SensitiveValue": { 17 | "$ref": "#/definitions/SensitiveValue", 18 | "readOnly": true 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /api/tenant-resource-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./tenant-resource.json", 3 | "id": "Tenants-1", 4 | "name": "asd", 5 | "links": { 6 | "asd": "bar" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /internal/extensions/change_control_extension_settings.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/extensions" 4 | 5 | type ChangeControlExtensionSettings struct { 6 | IsChangeControlled bool 7 | 8 | ExtensionSettings 9 | } 10 | 11 | // NewChangeControlExtensionSettings creates a settings structure a for change-controlled extension. 12 | func NewChangeControlExtensionSettings(extensionID extensions.ExtensionID, isChangeControlled bool) ChangeControlExtensionSettings { 13 | return ChangeControlExtensionSettings{ 14 | IsChangeControlled: isChangeControlled, 15 | ExtensionSettings: NewExtensionSettings(extensionID), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /internal/extensions/connected_change_control_extension_settings.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/extensions" 4 | 5 | type ConnectedChangeControlExtensionSettings struct { 6 | ConnectionID string 7 | 8 | ChangeControlExtensionSettings 9 | } 10 | 11 | // NewConnectedChangeControlExtensionSettings creates a settings structure a for connected and change-controlled extension. 12 | func NewConnectedChangeControlExtensionSettings(extensionID extensions.ExtensionID, isChangeControlled bool, connectionID string) ConnectedChangeControlExtensionSettings { 13 | return ConnectedChangeControlExtensionSettings{ 14 | ConnectionID: connectionID, 15 | ChangeControlExtensionSettings: NewChangeControlExtensionSettings(extensionID, isChangeControlled), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /internal/extensions/extension_settings.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/extensions" 4 | 5 | type ExtensionSettings struct { 6 | ExtensionID extensions.ExtensionID `json:"ExtensionId,omitempty"` 7 | } 8 | 9 | // NewExtensionSettings creates a settings structure for an extension. 10 | func NewExtensionSettings(extensionID extensions.ExtensionID) ExtensionSettings { 11 | return ExtensionSettings{ 12 | ExtensionID: extensionID, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /internal/json.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | ) 7 | 8 | func PrettyJSON(data interface{}) string { 9 | buffer := new(bytes.Buffer) 10 | encoder := json.NewEncoder(buffer) 11 | encoder.SetIndent("", "\t") 12 | 13 | encoder.Encode(data) 14 | return buffer.String() 15 | } 16 | -------------------------------------------------------------------------------- /internal/links.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import "reflect" 4 | 5 | func IsLinksEqual(linksA map[string]string, linksB map[string]string) bool { 6 | return reflect.DeepEqual(linksA, linksB) 7 | } 8 | -------------------------------------------------------------------------------- /internal/types.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | func Bool(v bool) *bool { return &v } 4 | func Int(v int) *int { return &v } 5 | func Int64(v int64) *int64 { return &v } 6 | func String(v string) *string { return &v } 7 | -------------------------------------------------------------------------------- /pkg/accounts/account_types.go: -------------------------------------------------------------------------------- 1 | package accounts 2 | 3 | type AccountType string 4 | 5 | const ( 6 | AccountTypeNone = AccountType("None") 7 | AccountTypeAmazonWebServicesAccount = AccountType("AmazonWebServicesAccount") 8 | AccountTypeAzureServicePrincipal = AccountType("AzureServicePrincipal") 9 | AccountTypeAzureOIDC = AccountType("AzureOidc") 10 | AccountTypeAwsOIDC = AccountType("AmazonWebServicesOidcAccount") 11 | AccountTypeAzureSubscription = AccountType("AzureSubscription") 12 | AccountTypeGenericOIDCAccount = AccountType("GenericOidcAccount") 13 | AccountTypeGoogleCloudPlatformAccount = AccountType("GoogleCloudAccount") 14 | AccountTypeSSHKeyPair = AccountType("SshKeyPair") 15 | AccountTypeToken = AccountType("Token") 16 | AccountTypeUsernamePassword = AccountType("UsernamePassword") 17 | ) 18 | -------------------------------------------------------------------------------- /pkg/accounts/accounts_query.go: -------------------------------------------------------------------------------- 1 | package accounts 2 | 3 | // AccountsQuery represents parameters to query the Accounts service. 4 | type AccountsQuery struct { 5 | AccountType AccountType `uri:"accountType,omitempty"` 6 | IDs []string `uri:"ids,omitempty"` 7 | PartialName string `uri:"partialName,omitempty"` 8 | Skip int `uri:"skip,omitempty"` 9 | Take int `uri:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/accounts/is_nil.go: -------------------------------------------------------------------------------- 1 | package accounts 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *AccountResource: 6 | return v == nil 7 | case *AmazonWebServicesAccount: 8 | return v == nil 9 | case *AwsOIDCAccount: 10 | return v == nil 11 | case *AzureServicePrincipalAccount: 12 | return v == nil 13 | case *AzureOIDCAccount: 14 | return v == nil 15 | case *AzureSubscriptionAccount: 16 | return v == nil 17 | case *GoogleCloudPlatformAccount: 18 | return v == nil 19 | case *SSHKeyAccount: 20 | return v == nil 21 | case *TokenAccount: 22 | return v == nil 23 | case *UsernamePasswordAccount: 24 | return v == nil 25 | default: 26 | return v == nil 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/accounts/target_usage_entry.go: -------------------------------------------------------------------------------- 1 | package accounts 2 | 3 | type TargetUsageEntry struct { 4 | TargetID string `json:"TargetId,omitempty"` 5 | TargetName string `json:"TargetName,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/actions/action_type.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type ActionType int 4 | 5 | const ( 6 | AutoDeploy ActionType = iota 7 | DeployLatestRelease 8 | DeployNewRelease 9 | RunRunbook 10 | CreateRelease 11 | ) 12 | -------------------------------------------------------------------------------- /pkg/actions/auto_deploy_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type AutoDeployAction struct { 4 | ShouldRedeploy bool `json:"ShouldRedeployWhenMachineHasBeenDeployedTo"` 5 | 6 | triggerAction 7 | } 8 | 9 | func NewAutoDeployAction(shouldRedeploy bool) *AutoDeployAction { 10 | return &AutoDeployAction{ 11 | ShouldRedeploy: shouldRedeploy, 12 | triggerAction: *newTriggerAction(AutoDeploy), 13 | } 14 | } 15 | 16 | func (a *AutoDeployAction) GetActionType() ActionType { 17 | return a.Type 18 | } 19 | 20 | func (a *AutoDeployAction) SetActionType(actionType ActionType) { 21 | a.Type = actionType 22 | } 23 | 24 | var _ ITriggerAction = &AutoDeployAction{} 25 | -------------------------------------------------------------------------------- /pkg/actions/community_action_templates_query.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type CommunityActionTemplatesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/actions/create_release_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type CreateReleaseAction struct { 4 | ChannelID string `json:"ChannelId,omitempty"` 5 | 6 | triggerAction 7 | } 8 | 9 | func NewCreateReleaseAction(channelId string) *CreateReleaseAction { 10 | return &CreateReleaseAction{ 11 | ChannelID: channelId, 12 | triggerAction: *newTriggerAction(CreateRelease), 13 | } 14 | } 15 | 16 | func (a *CreateReleaseAction) GetActionType() ActionType { 17 | return a.Type 18 | } 19 | 20 | func (a *CreateReleaseAction) SetActionType(actionType ActionType) { 21 | a.Type = actionType 22 | } 23 | 24 | var _ ITriggerAction = &CreateReleaseAction{} 25 | -------------------------------------------------------------------------------- /pkg/actions/is_nil.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *CommunityActionTemplate: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/actions/project_trigger_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type ProjectTriggerAction struct { 4 | ActionType string `json:"ActionType"` 5 | DestinationEnvironmentID string `json:"DestinationEnvironmentId"` 6 | ShouldRedeployWhenMachineHasBeenDeployedTo bool `json:"ShouldRedeployWhenMachineHasBeenDeployedTo"` 7 | SourceEnvironmentID string `json:"SourceEnvironmentId"` 8 | } 9 | 10 | func (a *ProjectTriggerAction) GetActionType() ActionType { 11 | actionType, _ := ActionTypeString(a.ActionType) 12 | return actionType 13 | } 14 | 15 | func (a *ProjectTriggerAction) SetActionType(actionType ActionType) { 16 | a.ActionType = actionType.String() 17 | } 18 | 19 | var _ ITriggerAction = &ProjectTriggerAction{} 20 | -------------------------------------------------------------------------------- /pkg/actions/run_runbook_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type RunRunbookAction struct { 4 | Environments []string `json:"EnvironmentIds"` 5 | Runbook string `json:"RunbookId"` 6 | Tenants []string `json:"TenantIds"` 7 | TenantTags []string `json:"TenantTags"` 8 | 9 | triggerAction 10 | } 11 | 12 | func NewRunRunbookAction() *RunRunbookAction { 13 | return &RunRunbookAction{ 14 | Environments: []string{}, 15 | Tenants: []string{}, 16 | TenantTags: []string{}, 17 | triggerAction: *newTriggerAction(RunRunbook), 18 | } 19 | } 20 | 21 | func (a *RunRunbookAction) GetActionType() ActionType { 22 | return a.Type 23 | } 24 | 25 | func (a *RunRunbookAction) SetActionType(actionType ActionType) { 26 | a.Type = actionType 27 | } 28 | 29 | var _ ITriggerAction = &RunRunbookAction{} 30 | -------------------------------------------------------------------------------- /pkg/actions/scoped_deployment_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type scopedDeploymentAction struct { 4 | Channel string `json:"ChannelId,omitempty"` 5 | Tenants []string `json:"TenantIds,omitempty"` 6 | TenantTags []string `json:"TenantTags,omitempty"` 7 | 8 | triggerAction 9 | } 10 | 11 | func newScopedDeploymentAction(actionType ActionType) *scopedDeploymentAction { 12 | return &scopedDeploymentAction{ 13 | Tenants: []string{}, 14 | TenantTags: []string{}, 15 | triggerAction: *newTriggerAction(actionType), 16 | } 17 | } 18 | 19 | func (a *scopedDeploymentAction) GetActionType() ActionType { 20 | return a.Type 21 | } 22 | 23 | func (a *scopedDeploymentAction) SetActionType(actionType ActionType) { 24 | a.Type = actionType 25 | } 26 | 27 | var _ ITriggerAction = &scopedDeploymentAction{} 28 | -------------------------------------------------------------------------------- /pkg/actions/trigger_action.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | // ITriggerAction defines the interface for trigger actions. 6 | type ITriggerAction interface { 7 | GetActionType() ActionType 8 | SetActionType(actionType ActionType) 9 | } 10 | 11 | type triggerAction struct { 12 | Type ActionType `json:"ActionType"` 13 | 14 | resources.Resource 15 | } 16 | 17 | func newTriggerAction(actionType ActionType) *triggerAction { 18 | return &triggerAction{ 19 | Type: actionType, 20 | Resource: *resources.NewResource(), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/actions/version_control_reference.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | type VersionControlReference struct { 4 | GitRef string `json:"GitRef"` 5 | GitCommit string `json:"GitCommit"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/actiontemplates/action_template_category.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | // ActionTemplateCategory represents an action template category. 4 | type ActionTemplateCategory struct { 5 | DisplayOrder int32 `json:"DisplayOrder,omitempty"` 6 | ID string `json:"Id,omitempty"` 7 | Links map[string]string `json:"Links,omitempty"` 8 | Name string `json:"Name,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/actiontemplates/action_template_logo_query.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | type ActionTemplateLogoQuery struct { 4 | CB string `uri:"cb,omitempty" url:"cb,omitempty"` 5 | TypeOrID string `uri:"typeOrId,omitempty" url:"typeOrId,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/actiontemplates/action_template_parameter.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | // ActionTemplateParameter represents an action template parameter. 9 | type ActionTemplateParameter struct { 10 | DefaultValue *core.PropertyValue `json:"DefaultValue,omitempty"` 11 | DisplaySettings map[string]string `json:"DisplaySettings,omitempty"` 12 | HelpText string `json:"HelpText,omitempty"` 13 | Label string `json:"Label,omitempty"` 14 | Name string `json:"Name,omitempty"` 15 | 16 | resources.Resource 17 | } 18 | 19 | func NewActionTemplateParameter() *ActionTemplateParameter { 20 | return &ActionTemplateParameter{ 21 | Resource: *resources.NewResource(), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pkg/actiontemplates/action_template_versioned_logo_query.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | type ActionTemplateVersionedLogoQuery struct { 4 | CB string `uri:"cb,omitempty" url:"cb,omitempty"` 5 | TypeOrID string `uri:"typeOrId,omitempty" url:"typeOrId,omitempty"` 6 | Version string `uri:"version,omitempty" url:"version,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/actiontemplates/is_nil.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *ActionTemplate: 6 | return v == nil 7 | case *ActionTemplateParameter: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/actiontemplates/query.go: -------------------------------------------------------------------------------- 1 | package actiontemplates 2 | 3 | // Query represents parameters to query the ActionTemplates service. 4 | type Query struct { 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/artifacts/artifact.go: -------------------------------------------------------------------------------- 1 | package artifacts 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 7 | ) 8 | 9 | // Artifact represents an artifact. 10 | type Artifact struct { 11 | Created *time.Time `json:"Created,omitempty"` 12 | Filename string `json:"Filename" validate:"required"` 13 | LogCorrelationID string `json:"LogCorrelationId,omitempty"` 14 | ServerTaskID string `json:"ServerTaskId,omitempty"` 15 | Source string `json:"Source,omitempty"` 16 | SpaceID string `json:"SpaceId,omitempty"` 17 | 18 | resources.Resource 19 | } 20 | 21 | // NewArtifact creates and initializes an artifact. 22 | func NewArtifact(filename string) *Artifact { 23 | return &Artifact{ 24 | Filename: filename, 25 | Resource: *resources.NewResource(), 26 | } 27 | } 28 | 29 | var _ resources.IResource = &Artifact{} 30 | -------------------------------------------------------------------------------- /pkg/artifacts/is_nil.go: -------------------------------------------------------------------------------- 1 | package artifacts 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Artifact: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/artifacts/query.go: -------------------------------------------------------------------------------- 1 | package artifacts 2 | 3 | type Query struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Order string `uri:"order" url:"order,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Regarding string `uri:"regarding,omitempty" url:"regarding,omitempty"` 8 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/authentication/authentication.go: -------------------------------------------------------------------------------- 1 | package authentication 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | // Authentication represents enabled authentication providers. 6 | type Authentication struct { 7 | AnyAuthenticationProvidersSupportPasswordManagement bool `json:"AnyAuthenticationProvidersSupportPasswordManagement"` 8 | AuthenticationProviders []*AuthenticationProviderElement `json:"AuthenticationProviders"` 9 | AutoLoginEnabled bool `json:"AutoLoginEnabled"` 10 | 11 | resources.Resource 12 | } 13 | 14 | func NewAuthentication() *Authentication { 15 | return &Authentication{ 16 | Resource: *resources.NewResource(), 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pkg/authentication/authentication_provider_element.go: -------------------------------------------------------------------------------- 1 | package authentication 2 | 3 | // AuthenticationProviderElement represents an authentication provider element. 4 | type AuthenticationProviderElement struct { 5 | CSSLinks []string `json:"CSSLinks"` 6 | FormsLoginEnabled bool `json:"FormsLoginEnabled"` 7 | IdentityType string `json:"IdentityType,omitempty"` 8 | JavascriptLinks []string `json:"JavascriptLinks"` 9 | Links map[string]string `json:"Links,omitempty"` 10 | Name string `json:"Name,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/authentication/is_nil.go: -------------------------------------------------------------------------------- 1 | package authentication 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Authentication: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/azure/azure_environment_service.go: -------------------------------------------------------------------------------- 1 | package azure 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type AzureEnvironmentService struct { 10 | services.Service 11 | } 12 | 13 | func NewAzureEnvironmentService(sling *sling.Sling, uriTemplate string) *AzureEnvironmentService { 14 | return &AzureEnvironmentService{ 15 | Service: services.NewService(constants.ServiceAzureEnvironmentService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/azure/devops/azure_devops_connectivity_check_service.go: -------------------------------------------------------------------------------- 1 | package devops 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type AzureDevOpsConnectivityCheckService struct { 10 | services.Service 11 | } 12 | 13 | func NewAzureDevOpsConnectivityCheckService(sling *sling.Sling, uriTemplate string) *AzureDevOpsConnectivityCheckService { 14 | return &AzureDevOpsConnectivityCheckService{ 15 | Service: services.NewService(constants.ServiceAzureDevOpsConnectivityCheckService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/buildinformation/build_information_bulk_query.go: -------------------------------------------------------------------------------- 1 | package buildinformation 2 | 3 | type BuildInformationBulkQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/buildinformation/build_information_query.go: -------------------------------------------------------------------------------- 1 | package buildinformation 2 | 3 | type BuildInformationQuery struct { 4 | Filter string `uri:"filter,omitempty" url:"filter,omitempty"` 5 | Latest bool `uri:"latest,omitempty" url:"latest,omitempty"` 6 | OverwriteMode string `uri:"overwriteMode,omitempty" url:"overwriteMode,omitempty"` 7 | PackageID string `uri:"packageId,omitempty" url:"packageId,omitempty"` 8 | IncludeWorkItems bool `uri:"includeWorkItems,omitempty" url:"includeWorkItems,omitempty"` 9 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 10 | Take int `uri:"take,omitempty" url:"take,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/buildinformation/is_nil.go: -------------------------------------------------------------------------------- 1 | package buildinformation 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *CreateBuildInformationCommand: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/buildinformation/overwrite_mode.go: -------------------------------------------------------------------------------- 1 | package buildinformation 2 | 3 | type OverwriteMode string 4 | 5 | const ( 6 | OverwriteModeFailIfExists = OverwriteMode("FailIfExists") 7 | OverwriteModeIgnoreIfExists = OverwriteMode("IgnoreIfExists") 8 | OverwriteModeOverwriteExisting = OverwriteMode("OverwriteExisting") 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/certificates/certificates_query.go: -------------------------------------------------------------------------------- 1 | package certificates 2 | 3 | type CertificatesQuery struct { 4 | Archived string `uri:"archived,omitempty" url:"archived,omitempty"` 5 | FirstResult string `uri:"firstResult,omitempty" url:"firstResult,omitempty"` 6 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 7 | OrderBy string `uri:"orderBy,omitempty" url:"orderBy,omitempty"` 8 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 9 | Search string `uri:"search,omitempty" url:"search,omitempty"` 10 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 11 | Take int `uri:"take,omitempty" url:"take,omitempty"` 12 | Tenant string `uri:"tenant,omitempty" url:"tenant,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/certificates/is_nil.go: -------------------------------------------------------------------------------- 1 | package certificates 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *CertificateResource: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/certificates/replacement_certificate.go: -------------------------------------------------------------------------------- 1 | package certificates 2 | 3 | type ReplacementCertificate struct { 4 | CertificateData string `json:"CertificateData,omitempty"` 5 | Password string `json:"Password,omitempty"` 6 | } 7 | 8 | func NewReplacementCertificate(certificateData string, password string) *ReplacementCertificate { 9 | return &ReplacementCertificate{ 10 | CertificateData: certificateData, 11 | Password: password, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pkg/channels/channel_git_resource_rule.go: -------------------------------------------------------------------------------- 1 | package channels 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/gitdependencies" 4 | 5 | type ChannelGitResourceRule struct { 6 | Id string `json:"Id,omitempty"` 7 | GitDependencyActions []gitdependencies.DeploymentActionGitDependency `json:"GitDependencyActions,omitempty"` 8 | Rules []string `json:"Rules,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/channels/channel_rule.go: -------------------------------------------------------------------------------- 1 | package channels 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | type ChannelRule struct { 9 | ActionPackages []packages.DeploymentActionPackage `json:"ActionPackages,omitempty"` 10 | ID string `json:"Id,omitempty"` 11 | Tag string `json:"Tag,omitempty"` 12 | 13 | //Use the NuGet or Maven versioning syntax (depending on the feed type) 14 | //to specify the range of versions to include 15 | VersionRange string `json:"VersionRange,omitempty"` 16 | 17 | resources.Resource 18 | } 19 | -------------------------------------------------------------------------------- /pkg/channels/is_nil.go: -------------------------------------------------------------------------------- 1 | package channels 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Channel: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/channels/query.go: -------------------------------------------------------------------------------- 1 | package channels 2 | 3 | type Query struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | 10 | type QueryByProjectID struct { 11 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 12 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 13 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 14 | Take int `uri:"take,omitempty" url:"take,omitempty"` 15 | } 16 | -------------------------------------------------------------------------------- /pkg/channels/version_rule_test_query.go: -------------------------------------------------------------------------------- 1 | package channels 2 | 3 | type VersionRuleTestQuery struct { 4 | FeedType string `uri:"feedType,omitempty" url:"feedType,omitempty"` 5 | PreReleaseTag string `uri:"preReleaseTag,omitempty" url:"preReleaseTag,omitempty"` 6 | Version string `uri:"version,omitempty" url:"version,omitempty"` 7 | VersionRange string `uri:"versionRange,omitempty" url:"versionRange,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/client/api_key_test.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/go-playground/assert/v2" 7 | ) 8 | 9 | func TestIsAPIKey(t *testing.T) { 10 | testCases := []struct { 11 | name string 12 | test string 13 | isValid bool 14 | }{ 15 | {"Empty", "", false}, 16 | {"EmptySpace", " ", false}, 17 | {"StartWithAPI", "API-", false}, 18 | {"Invalid", "API-?OBYCAMCZ7WWBKSTMXT66FCUDPS", false}, 19 | {"Invalid", "API-OBYC👍AMCZ7WWBKSTMXT66FCUDPS", false}, 20 | {"Invalid", "API-***************************", false}, 21 | {"Valid", "API-EOAYCAFCZ7WWBKSTMVT66FCUDPS", true}, 22 | {"Valid", "API-EOBYCAMCZ7WWBKSTMVT66FCUDPR", true}, 23 | } 24 | for _, tc := range testCases { 25 | t.Run(tc.name, func(t *testing.T) { 26 | testResult := IsAPIKey(tc.test) 27 | assert.Equal(t, testResult, tc.isValid) 28 | }) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pkg/client/is_nil.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *RootResource: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/cloudtemplate/cloud_template_query.go: -------------------------------------------------------------------------------- 1 | package cloudtemplate 2 | 3 | type CloudTemplateQuery struct { 4 | FeedID string `uri:"feedId,omitempty" url:"feedId,omitempty"` 5 | PackageID string `uri:"packageId,omitempty" url:"packageId,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/cloudtemplate/cloud_template_service.go: -------------------------------------------------------------------------------- 1 | package cloudtemplate 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type CloudTemplateService struct { 10 | services.Service 11 | } 12 | 13 | func NewCloudTemplateService(sling *sling.Sling, uriTemplate string) *CloudTemplateService { 14 | return &CloudTemplateService{ 15 | Service: services.NewService(constants.ServiceCloudTemplateService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/certificate_configuration_query.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | type CertificateConfigurationQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/configuration/certificate_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type CertificateConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewCertificateConfigurationService(sling *sling.Sling, uriTemplate string) *CertificateConfigurationService { 14 | return &CertificateConfigurationService{ 15 | Service: services.NewService(constants.ServiceCertificateConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/configuration_section.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type ConfigurationSection struct { 6 | Description string `json:"Description,omitempty"` 7 | Name string `json:"Name,omitempty"` 8 | 9 | resources.Resource 10 | } 11 | 12 | func NewConfigurationSection() *ConfigurationSection { 13 | return &ConfigurationSection{ 14 | Resource: *resources.NewResource(), 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pkg/configuration/feature_toggle_configuration.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | type FeatureToggleConfigurationQuery struct { 4 | Name string `uri:"Name,omitempty" url:"Name,omitempty"` 5 | } 6 | 7 | type FeatureToggleConfigurationResponse struct { 8 | FeatureToggles []ConfiguredFeatureToggle `json:"FeatureToggles"` 9 | } 10 | 11 | type ConfiguredFeatureToggle struct { 12 | Name string `json:"Name"` 13 | IsEnabled bool `json:"IsEnabled"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/configuration/feature_toggle_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/newclient" 5 | ) 6 | 7 | type FeatureToggleConfigurationService struct{} 8 | 9 | const template = "/api/configuration/feature-toggles{?Name}" 10 | 11 | func Get(client newclient.Client, query *FeatureToggleConfigurationQuery) (*FeatureToggleConfigurationResponse, error) { 12 | return newclient.GetResourceByQuery[FeatureToggleConfigurationResponse](client, template, query) 13 | } 14 | -------------------------------------------------------------------------------- /pkg/configuration/features_configuration.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type FeaturesConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewFeaturesConfigurationService(sling *sling.Sling, uriTemplate string) *FeaturesConfigurationService { 14 | return &FeaturesConfigurationService{ 15 | Service: services.NewService(constants.ServiceFeaturesConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/is_nil.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *ConfigurationSection: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/configuration/lets_encrypt_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type LetsEncryptConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewLetsEncryptConfigurationService(sling *sling.Sling, uriTemplate string) *LetsEncryptConfigurationService { 14 | return &LetsEncryptConfigurationService{ 15 | Service: services.NewService(constants.ServiceLetsEncryptConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/maintenance_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type MaintenanceConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewMaintenanceConfigurationService(sling *sling.Sling, uriTemplate string) *MaintenanceConfigurationService { 14 | return &MaintenanceConfigurationService{ 15 | Service: services.NewService(constants.ServiceMaintenanceConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/performance_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type PerformanceConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewPerformanceConfigurationService(sling *sling.Sling, uriTemplate string) *PerformanceConfigurationService { 14 | return &PerformanceConfigurationService{ 15 | Service: services.NewService(constants.ServicePerformanceConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/configuration/server_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type ServerConfigurationService struct { 10 | settingsPath string 11 | 12 | services.Service 13 | } 14 | 15 | func NewServerConfigurationService(sling *sling.Sling, uriTemplate string, settingsPath string) *ServerConfigurationService { 16 | return &ServerConfigurationService{ 17 | settingsPath: settingsPath, 18 | Service: services.NewService(constants.ServiceServerConfigurationService, sling, uriTemplate), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/configuration/smtp_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type SmtpConfigurationService struct { 10 | isConfiguredPath string 11 | 12 | services.Service 13 | } 14 | 15 | func NewSmtpConfigurationService(sling *sling.Sling, uriTemplate string, isConfiguredPath string) *SmtpConfigurationService { 16 | return &SmtpConfigurationService{ 17 | isConfiguredPath: isConfiguredPath, 18 | Service: services.NewService(constants.ServiceSMTPConfigurationService, sling, uriTemplate), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/configuration/upgrade_configuration_service.go: -------------------------------------------------------------------------------- 1 | package configuration 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type UpgradeConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewUpgradeConfigurationService(sling *sling.Sling, uriTemplate string) *UpgradeConfigurationService { 14 | return &UpgradeConfigurationService{ 15 | Service: services.NewService(constants.ServiceUpgradeConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/constants/constants_action_types.go: -------------------------------------------------------------------------------- 1 | package constants 2 | 3 | const ( 4 | ActionTypeAWSApplyCloudFormationChangeset string = "Octopus.AwsApplyCloudFormationChangeSet" 5 | ActionTypeAWSDeleteCloudFormation string = "Octopus.AwsDeleteCloudFormation" 6 | ActionTypeAWSRunCloudFormation string = "Octopus.AwsRunCloudFormation" 7 | ActionTypeAWSRunScript string = "Octopus.AwsRunScript" 8 | ActionTypeAWSUploadS3 string = "Octopus.AwsUploadS3" 9 | ActionTypeOctopusScript string = "Octopus.Script" 10 | ActionTypeOctopusActionScriptBody string = "Octopus.Action.Script.ScriptBody" 11 | ) 12 | -------------------------------------------------------------------------------- /pkg/constants/constants_client.go: -------------------------------------------------------------------------------- 1 | package constants 2 | 3 | const ( 4 | ClientAPIKeyHTTPHeader string = "X-Octopus-ApiKey" 5 | ClientNewClient string = "NewClient" 6 | ClientURLEnvironmentVariable string = "OCTOPUS_URL" 7 | ClientAPIKeyEnvironmentVariable string = "OCTOPUS_APIKEY" 8 | EnvironmentVariableOctopusHost string = "OCTOPUS_HOST" 9 | EnvironmentVariableOctopusApiKey string = "OCTOPUS_API_KEY" 10 | EnvironmentVariableOctopusSpace string = "OCTOPUS_SPACE" 11 | ) 12 | -------------------------------------------------------------------------------- /pkg/core/connectivity_check.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type ConnectivityCheck struct { 4 | DependsOnPropertyNames []string `json:"DependsOnPropertyNames"` 5 | Title string `json:"Title,omitempty"` 6 | URL string `json:"Url,omitempty"` 7 | } 8 | 9 | func NewConnectivityCheck() *ConnectivityCheck { 10 | return &ConnectivityCheck{} 11 | } 12 | -------------------------------------------------------------------------------- /pkg/core/connectivity_policy.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type ConnectivityPolicy struct { 4 | AllowDeploymentsToNoTargets bool `json:"AllowDeploymentsToNoTargets"` 5 | ExcludeUnhealthyTargets bool `json:"ExcludeUnhealthyTargets"` 6 | SkipMachineBehavior SkipMachineBehavior `json:"SkipMachineBehavior,omitempty"` 7 | TargetRoles []string `json:"TargetRoles,omitempty"` 8 | } 9 | 10 | func NewConnectivityPolicy() *ConnectivityPolicy { 11 | return &ConnectivityPolicy{ 12 | AllowDeploymentsToNoTargets: false, 13 | ExcludeUnhealthyTargets: false, 14 | SkipMachineBehavior: "None", 15 | TargetRoles: []string{}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/core/deployment_mode_types.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type TenantedDeploymentMode string 4 | 5 | const ( 6 | TenantedDeploymentModeTenanted = TenantedDeploymentMode("Tenanted") 7 | TenantedDeploymentModeTenantedOrUntenanted = TenantedDeploymentMode("TenantedOrUntenanted") 8 | TenantedDeploymentModeUntenanted = TenantedDeploymentMode("Untenanted") 9 | ) 10 | 11 | type GuidedFailureMode string 12 | 13 | const ( 14 | GuidedFailureModeEnvironmentDefault = GuidedFailureMode("EnvironmentDefault") 15 | GuidedFailureModeOff = GuidedFailureMode("Off") 16 | GuidedFailureModeOn = GuidedFailureMode("On") 17 | ) 18 | -------------------------------------------------------------------------------- /pkg/core/named_reference_item.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type NamedReferenceItem struct { 4 | DisplayIDAndName bool `json:"DisplayIdAndName"` 5 | DisplayName string `json:"DisplayName,omitempty"` 6 | ID string `json:"Id,omitempty"` 7 | } 8 | 9 | func NewNamedReferenceItem() *NamedReferenceItem { 10 | return &NamedReferenceItem{} 11 | } 12 | -------------------------------------------------------------------------------- /pkg/core/retention_period.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type RetentionPeriod struct { 4 | QuantityToKeep int32 `json:"QuantityToKeep"` 5 | ShouldKeepForever bool `json:"ShouldKeepForever"` 6 | Unit string `json:"Unit"` 7 | } 8 | 9 | func NewRetentionPeriod(quantityToKeep int32, unit string, shouldKeepForever bool) *RetentionPeriod { 10 | return &RetentionPeriod{ 11 | QuantityToKeep: quantityToKeep, 12 | ShouldKeepForever: shouldKeepForever, 13 | Unit: unit, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pkg/core/sensitive_value.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | // NewSensitiveValue creates and initializes a sensitive value. 4 | func NewSensitiveValue(newValue string) *SensitiveValue { 5 | if len(newValue) > 0 { 6 | return &SensitiveValue{ 7 | HasValue: true, 8 | NewValue: &newValue, 9 | } 10 | } 11 | 12 | return &SensitiveValue{ 13 | HasValue: false, 14 | } 15 | } 16 | 17 | type SensitiveValue struct { 18 | HasValue bool 19 | Hint *string 20 | NewValue *string 21 | } 22 | -------------------------------------------------------------------------------- /pkg/core/skip_machine_behavior.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type SkipMachineBehavior string 4 | 5 | const ( 6 | SkipMachineBehaviorNone = SkipMachineBehavior("None") 7 | SkipMachineBehaviorSkipUnavailableMachines = SkipMachineBehavior("SkipUnavailableMachines") 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/core/skip_take_query.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type SkipTakeQuery struct { 4 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 5 | Take int `uri:"take,omitempty" url:"take,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/core/work_item_link.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | type WorkItemLink struct { 4 | Description string `json:"Description,omitempty"` 5 | ID string `json:"Id,omitempty"` 6 | LinkURL string `json:"LinkUrl,omitempty"` 7 | Source string `json:"Source,omitempty"` 8 | } 9 | 10 | func NewWorkItemLink() *WorkItemLink { 11 | return &WorkItemLink{} 12 | } 13 | -------------------------------------------------------------------------------- /pkg/credentials/anonymous.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | type Anonymous struct { 4 | gitCredential 5 | } 6 | 7 | func NewAnonymous() *Anonymous { 8 | return &Anonymous{ 9 | gitCredential: gitCredential{ 10 | CredentialType: GitCredentialTypeAnonymous, 11 | }, 12 | } 13 | } 14 | 15 | // Type returns the type for this Git credential. 16 | func (a *Anonymous) Type() Type { 17 | return a.CredentialType 18 | } 19 | 20 | var _ GitCredential = &Anonymous{} 21 | -------------------------------------------------------------------------------- /pkg/credentials/anonymous_test.go: -------------------------------------------------------------------------------- 1 | package credentials_test 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "testing" 7 | 8 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/credentials" 9 | "github.com/kinbiko/jsonassert" 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestAnonymousMarshalJSON(t *testing.T) { 14 | anonymous := credentials.NewAnonymous() 15 | 16 | anonymousAsJSON, err := json.Marshal(anonymous) 17 | require.NoError(t, err) 18 | require.NotNil(t, anonymousAsJSON) 19 | 20 | expectedJSON := fmt.Sprintf(`{ 21 | "Type": "%s" 22 | }`, credentials.GitCredentialTypeAnonymous) 23 | 24 | jsonassert.New(t).Assertf(expectedJSON, string(anonymousAsJSON)) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/credentials/git_credential.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | // GitCredential defines the interface for Git credentials. 4 | type GitCredential interface { 5 | Type() Type 6 | } 7 | 8 | // gitCredential is the embedded struct used for Git credentials. 9 | type gitCredential struct { 10 | CredentialType Type `json:"Type" validate:"omitempty,oneof=Anonymous Reference UsernamePassword"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/credentials/is_nil.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Resource: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/credentials/query.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | type Query struct { 4 | Name string `uri:"name,omitempty" url:"name,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/credentials/reference.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | // Reference defines a reference Git credential. 4 | type Reference struct { 5 | ID string `json:"Id"` 6 | 7 | gitCredential 8 | } 9 | 10 | // NewReference creates and initializes a reference Git credential. 11 | func NewReference(id string) *Reference { 12 | return &Reference{ 13 | ID: id, 14 | gitCredential: gitCredential{ 15 | CredentialType: GitCredentialTypeReference, 16 | }, 17 | } 18 | } 19 | 20 | // Type returns the type for this Git credential. 21 | func (u *Reference) Type() Type { 22 | return u.CredentialType 23 | } 24 | 25 | var _ GitCredential = &Reference{} 26 | -------------------------------------------------------------------------------- /pkg/credentials/reference_test.go: -------------------------------------------------------------------------------- 1 | package credentials_test 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "testing" 7 | 8 | "github.com/OctopusDeploy/go-octopusdeploy/v2/internal" 9 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/credentials" 10 | "github.com/kinbiko/jsonassert" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestReferenceMarshalJSON(t *testing.T) { 15 | id := internal.GetRandomName() 16 | reference := credentials.NewReference(id) 17 | 18 | referenceAsJSON, err := json.Marshal(reference) 19 | require.NoError(t, err) 20 | require.NotNil(t, referenceAsJSON) 21 | 22 | expectedJSON := fmt.Sprintf(`{ 23 | "Id": "%s", 24 | "Type": "%s" 25 | }`, id, credentials.GitCredentialTypeReference) 26 | 27 | jsonassert.New(t).Assertf(expectedJSON, string(referenceAsJSON)) 28 | } 29 | -------------------------------------------------------------------------------- /pkg/credentials/types.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | type Type string 4 | 5 | const ( 6 | GitCredentialTypeAnonymous = Type("Anonymous") 7 | GitCredentialTypeReference = Type("Reference") 8 | GitCredentialTypeUsernamePassword = Type("UsernamePassword") 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/credentials/username_password.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 5 | ) 6 | 7 | // UsernamePassword defines a username-password Git credential. 8 | type UsernamePassword struct { 9 | Password *core.SensitiveValue `json:"Password"` 10 | Username string `json:"Username"` 11 | 12 | gitCredential 13 | } 14 | 15 | // NewUsernamePassword creates and initializes an username-password Git credential. 16 | func NewUsernamePassword(username string, password *core.SensitiveValue) *UsernamePassword { 17 | return &UsernamePassword{ 18 | Password: password, 19 | Username: username, 20 | gitCredential: gitCredential{ 21 | CredentialType: GitCredentialTypeUsernamePassword, 22 | }, 23 | } 24 | } 25 | 26 | // Type returns the type for this Git credential. 27 | func (u *UsernamePassword) Type() Type { 28 | return u.CredentialType 29 | } 30 | 31 | var _ GitCredential = &UsernamePassword{} 32 | -------------------------------------------------------------------------------- /pkg/dashboard/dashboard_configuration_service.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type DashboardConfigurationService struct { 10 | services.Service 11 | } 12 | 13 | func NewDashboardConfigurationService(sling *sling.Sling, uriTemplate string) *DashboardConfigurationService { 14 | return &DashboardConfigurationService{ 15 | Service: services.NewService(constants.ServiceDashboardConfigurationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/dashboard/dashboard_dynamic_query.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | type DashboardDynamicQuery struct { 4 | Environments []string `uri:"environments,omitempty" url:"environments,omitempty"` 5 | IncludePrevious bool `uri:"includePrevious,omitempty" url:"includePrevious,omitempty"` 6 | Projects []string `uri:"projects,omitempty" url:"projects,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/dashboard/dashboard_query.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | type DashboardQuery struct { 4 | IncludeLatest bool `url:"highestLatestVersionPerProjectAndEnvironment"` 5 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 6 | SelectedTags []string `uri:"selectedTags,omitempty" url:"selectedTags,omitempty"` 7 | SelectedTenants []string `uri:"selectedTenants,omitempty" url:"selectedTenants,omitempty"` 8 | ShowAll bool `uri:"showAll,omitempty" url:"showAll,omitempty"` 9 | ReleaseID string `uri:"releaseId,omitempty" url:"releaseId,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/dashboard/dashboard_service.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type DashboardService struct { 10 | dashboardDynamicPath string 11 | 12 | services.Service 13 | } 14 | 15 | func NewDashboardService(sling *sling.Sling, uriTemplate string, dashboardDynamicPath string) *DashboardService { 16 | return &DashboardService{ 17 | dashboardDynamicPath: dashboardDynamicPath, 18 | Service: services.NewService(constants.ServiceDashboardService, sling, uriTemplate), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/deploymentfreezes/deploymentfreeze_query.go: -------------------------------------------------------------------------------- 1 | package deploymentfreezes 2 | 3 | type DeploymentFreezeQuery struct { 4 | IncludeComplete bool `uri:"includeComplete,omitempty" url:"includeComplete,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Status string `uri:"status,omitempty" url:"status,omitempty"` 7 | ProjectIds []string `uri:"projectIds,omitempty" url:"projectIds,omitempty"` 8 | TenantIds []string `uri:"tenantIds,omitempty" url:"tenantIds,omitempty"` 9 | EnvironmentIds []string `uri:"environmentIds,omitempty" url:"environmentIds,omitempty"` 10 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 11 | Skip int `uri:"skip" url:"skip"` 12 | Take int `uri:"take,omitempty" url:"take,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/deploymentfreezes/deploymentfreeze_service_test.go: -------------------------------------------------------------------------------- 1 | package deploymentfreezes 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/newclient" 5 | "github.com/stretchr/testify/require" 6 | "testing" 7 | ) 8 | 9 | func createClient() newclient.Client { 10 | return newclient.NewClient(&newclient.HttpSession{}) 11 | } 12 | 13 | func TestAddParameterValidation(t *testing.T) { 14 | client := createClient() 15 | _, err := Add(client, nil) 16 | require.Error(t, err) 17 | } 18 | -------------------------------------------------------------------------------- /pkg/deployments/channel_rule.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | type ChannelRule struct { 9 | ActionPackages []packages.DeploymentActionPackage `json:"ActionPackages,omitempty"` 10 | ID string `json:"Id,omitempty"` 11 | Tag string `json:"Tag,omitempty"` 12 | 13 | //Use the NuGet or Maven versioning syntax (depending on the feed type) 14 | //to specify the range of versions to include 15 | VersionRange string `json:"VersionRange,omitempty"` 16 | 17 | resources.Resource 18 | } 19 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_action_container.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentActionContainer struct { 4 | FeedID string `json:"FeedId,omitempty"` 5 | Image string `json:"Image,omitempty"` 6 | } 7 | 8 | // NewDeploymentActionContainer creates and initializes a new Kubernetes endpoint. 9 | func NewDeploymentActionContainer(feedID *string, image *string) *DeploymentActionContainer { 10 | deploymentActionContainer := &DeploymentActionContainer{} 11 | 12 | if feedID != nil && len(*feedID) > 0 { 13 | deploymentActionContainer.FeedID = *feedID 14 | } 15 | 16 | if image != nil && len(*image) > 0 { 17 | deploymentActionContainer.Image = *image 18 | } 19 | 20 | return deploymentActionContainer 21 | } 22 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_processes_query.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentProcessesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_query.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentQuery struct { 4 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 5 | Take int `uri:"take,omitempty" url:"take,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_service_test.go: -------------------------------------------------------------------------------- 1 | package deployments_test 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments" 5 | "testing" 6 | 7 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 8 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 9 | "github.com/stretchr/testify/assert" 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestDeploymentServiceGetByIDs(t *testing.T) { 14 | service := createDeploymentService(t) 15 | require.NotNil(t, service) 16 | 17 | ids := []string{"Accounts-285", "Accounts-286"} 18 | resources, err := service.GetByIDs(ids) 19 | 20 | assert.NoError(t, err) 21 | assert.NotNil(t, resources) 22 | } 23 | 24 | func createDeploymentService(t *testing.T) *deployments.DeploymentService { 25 | service := deployments.NewDeploymentService(nil, constants.TestURIDeployments) 26 | services.NewServiceTests(t, service, constants.TestURIDeployments, constants.ServiceDeploymentService) 27 | return service 28 | } 29 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_step_condition_types.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentStepConditionType string 4 | 5 | const ( 6 | DeploymentStepConditionTypeSuccess DeploymentStepConditionType = "Success" 7 | DeploymentStepConditionTypeFailure DeploymentStepConditionType = "Failure" 8 | DeploymentStepConditionTypeAlways DeploymentStepConditionType = "Always" 9 | DeploymentStepConditionTypeVariable DeploymentStepConditionType = "Variable" 10 | ) 11 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_step_package_requirement.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentStepPackageRequirement string 4 | 5 | const ( 6 | DeploymentStepPackageRequirementLetOctopusDecide DeploymentStepPackageRequirement = "LetOctopusDecide" 7 | DeploymentStepPackageRequirementBeforePackageAcquisition DeploymentStepPackageRequirement = "BeforePackageAcquisition" 8 | DeploymentStepPackageRequirementAfterPackageAcquisition DeploymentStepPackageRequirement = "AfterPackageAcquisition" 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/deployments/deployment_step_start_trigger.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentStepStartTrigger string 4 | 5 | const ( 6 | DeploymentStepStartTriggerStartAfterPrevious DeploymentStepStartTrigger = "StartAfterPrevious" 7 | DeploymentStepStartTriggerStartWithPrevious DeploymentStepStartTrigger = "StartWithPrevious" 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/deployments/deployments_query.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type DeploymentsQuery struct { 4 | Channels string `uri:"channels,omitempty" url:"channels,omitempty"` 5 | Environments []string `uri:"environments,omitempty" url:"environments,omitempty"` 6 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 7 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 8 | Projects []string `uri:"projects,omitempty" url:"projects,omitempty"` 9 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 10 | Take int `uri:"take,omitempty" url:"take,omitempty"` 11 | TaskState string `uri:"taskState,omitempty" url:"taskState,omitempty"` 12 | Tenants []string `uri:"tenants,omitempty" url:"tenants,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/deployments/is_nil.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Deployment: 6 | return v == nil 7 | case *DeploymentProcess: 8 | return v == nil 9 | case *DeploymentStep: 10 | return v == nil 11 | default: 12 | return v == nil 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pkg/deployments/step_usage.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type StepUsage struct { 4 | ProjectID string `json:"ProjectId,omitempty"` 5 | ProjectName string `json:"ProjectName,omitempty"` 6 | ProjectSlug string `json:"ProjectSlug,omitempty"` 7 | Steps []*StepUsageEntry `json:"Steps"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/deployments/step_usage_entry.go: -------------------------------------------------------------------------------- 1 | package deployments 2 | 3 | type StepUsageEntry struct { 4 | StepID string `json:"StepId,omitempty"` 5 | StepName string `json:"StepName,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/environments/environments_query.go: -------------------------------------------------------------------------------- 1 | package environments 2 | 3 | type EnvironmentsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Name string `uri:"name,omitempty" url:"name,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/environments/is_nil.go: -------------------------------------------------------------------------------- 1 | package environments 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Environment: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/events/change_details.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type ChangeDetails struct { 4 | Differences interface{} `json:"Differences,omitempty"` 5 | DocumentContext interface{} `json:"DocumentContext,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/events/document_type.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type DocumentType struct { 4 | ID string `json:"Id,omitempty"` 5 | Name string `json:"Name,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/events/event_agent.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventAgent struct { 4 | ID string `json:"Id,omitempty"` 5 | Links map[string]string `json:"Links,omitempty"` 6 | Name string `json:"Name,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/events/event_categories_query.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventCategoriesQuery struct { 4 | AppliesTo string `uri:"appliesTo" url:"appliesTo,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/events/event_category.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventCategory struct { 4 | ID string `json:"Id,omitempty"` 5 | Links map[string]string `json:"Links,omitempty"` 6 | Name string `json:"Name,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/events/event_group.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventGroup struct { 4 | EventCategories []string `json:"EventCategories"` 5 | ID string `json:"Id,omitempty"` 6 | Links map[string]string `json:"Links,omitempty"` 7 | Name string `json:"Name,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/events/event_groups_query.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventGroupsQuery struct { 4 | AppliesTo string `uri:"appliesTo" url:"appliesTo,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/events/event_reference.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | type EventReference struct { 4 | Length int32 `json:"Length,omitempty"` 5 | ReferencedDocumentID string `json:"ReferencedDocumentId,omitempty"` 6 | StartIndex int32 `json:"StartIndex,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/extensions/dynamic_extension_service.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type DynamicExtensionService struct { 10 | featuresMetadataPath string 11 | featuresValuesPath string 12 | scriptsPath string 13 | 14 | services.Service 15 | } 16 | 17 | func NewDynamicExtensionService(sling *sling.Sling, uriTemplate string, featuresMetadataPath string, featuresValuesPath string, scriptsPath string) *DynamicExtensionService { 18 | return &DynamicExtensionService{ 19 | featuresMetadataPath: featuresMetadataPath, 20 | featuresValuesPath: featuresValuesPath, 21 | scriptsPath: scriptsPath, 22 | Service: services.NewService(constants.ServiceDynamicExtensionService, sling, uriTemplate), 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /pkg/extensions/extension_identifiers.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | type ExtensionID string 4 | 5 | const ( 6 | JiraExtensionID = ExtensionID("jira-integration") 7 | JiraServiceManagementExtensionID = ExtensionID("jiraservicemanagement-integration") 8 | ServiceNowExtensionID = ExtensionID("servicenow-integration") 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/extensions/extension_settings.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | type ExtensionSettings interface { 4 | ExtensionID() ExtensionID 5 | SetExtensionID(ExtensionID) 6 | } 7 | 8 | type ChangeControlExtensionSettings interface { 9 | IsChangeControlled() bool 10 | SetIsChangeControlled(bool) 11 | 12 | ExtensionSettings 13 | } 14 | 15 | type ConnectedChangeControlExtensionSettings interface { 16 | ConnectionID() string 17 | SetConnectionID(string) 18 | 19 | ChangeControlExtensionSettings 20 | } 21 | -------------------------------------------------------------------------------- /pkg/externalsecuritygroupproviders/external_security_group_provider_service.go: -------------------------------------------------------------------------------- 1 | package externalsecuritygroupproviders 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type ExternalSecurityGroupProviderService struct { 10 | services.Service 11 | } 12 | 13 | func NewExternalSecurityGroupProviderService(sling *sling.Sling, uriTemplate string) *ExternalSecurityGroupProviderService { 14 | return &ExternalSecurityGroupProviderService{ 15 | Service: services.NewService(constants.ServiceExternalSecurityGroupProviderService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/feeds/built_in_feed_statistics.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type BuiltInFeedStatistics struct { 6 | TotalPackages int32 `json:"TotalPackages,omitempty"` 7 | 8 | resources.Resource 9 | } 10 | -------------------------------------------------------------------------------- /pkg/feeds/feed_types.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | type FeedType string 4 | 5 | const ( 6 | FeedTypeAwsElasticContainerRegistry = FeedType("AwsElasticContainerRegistry") 7 | FeedTypeAzureContainerRegistry = FeedType("AzureContainerRegistry") 8 | FeedTypeBuiltIn = FeedType("BuiltIn") 9 | FeedTypeDocker = FeedType("Docker") 10 | FeedTypeGitHub = FeedType("GitHub") 11 | FeedTypeGoogleContainerRegistry = FeedType("GoogleContainerRegistry") 12 | FeedTypeHelm = FeedType("Helm") 13 | FeedTypeMaven = FeedType("Maven") 14 | FeedTypeNuGet = FeedType("NuGet") 15 | FeedTypeOctopusProject = FeedType("OctopusProject") 16 | FeedTypeArtifactoryGeneric = FeedType("ArtifactoryGeneric") 17 | FeedTypeS3 = FeedType("S3") 18 | FeedTypeOCIRegistry = FeedType("OciRegistry") 19 | ) 20 | -------------------------------------------------------------------------------- /pkg/feeds/feeds_query.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | type FeedsQuery struct { 4 | Name string `uri:"name,omitempty" url:"name,omitempty"` 5 | FeedType string `uri:"feedType,omitempty" url:"feedType,omitempty"` 6 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 7 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 8 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/feeds/is_nil.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *AwsElasticContainerRegistry: 6 | return v == nil 7 | case *BuiltInFeed: 8 | return v == nil 9 | case *DockerContainerRegistry: 10 | return v == nil 11 | case *feed: 12 | return v == nil 13 | case *FeedResource: 14 | return v == nil 15 | case *GitHubRepositoryFeed: 16 | return v == nil 17 | case *HelmFeed: 18 | return v == nil 19 | case *MavenFeed: 20 | return v == nil 21 | case *NuGetFeed: 22 | return v == nil 23 | case *OctopusProjectFeed: 24 | return v == nil 25 | default: 26 | return v == nil 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/feeds/search_package_versions_query.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | type SearchPackageVersionsQuery struct { 4 | FeedID string `uri:"id,omitempty"` 5 | Filter string `uri:"filter,omitempty"` 6 | IncludePreRelease bool `uri:"includePreRelease,omitempty"` 7 | IncludeReleaseNotes bool `uri:"includeReleaseNotes,omitempty"` 8 | PackageID string `uri:"packageId,omitempty"` 9 | PreReleaseTag string `uri:"preReleaseTag,omitempty"` 10 | Skip int `uri:"skip,omitempty"` 11 | Take int `uri:"take,omitempty"` 12 | VersionRange string `uri:"versionRange,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/feeds/search_packages_query.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | type SearchPackagesQuery struct { 4 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 5 | Take int `uri:"take,omitempty" url:"take,omitempty"` 6 | Term string `uri:"term,omitempty" url:"term,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/filters/continuous_daily_scheduled_trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type ContinuousDailyScheduledTriggerFilter struct { 8 | Days []Weekday `json:"DaysOfWeek,omitempty"` 9 | HourInterval *int16 `json:"HourInterval,omitempty"` 10 | Interval *DailyScheduledInterval `json:"Interval,omitempty"` 11 | MinuteInterval *int16 `json:"MinuteInterval,omitempty"` 12 | RunAfter *time.Time `json:"RunAfter,omitempty"` 13 | RunUntil *time.Time `json:"RunUntil,omitempty"` 14 | 15 | scheduleTriggerFilter 16 | } 17 | 18 | func NewContinuousDailyScheduledTriggerFilter(days []Weekday, timeZone string) *ContinuousDailyScheduledTriggerFilter { 19 | return &ContinuousDailyScheduledTriggerFilter{ 20 | Days: days, 21 | scheduleTriggerFilter: *newScheduleTriggerFilter(ContinuousDailySchedule, timeZone), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pkg/filters/cron_scheduled_trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type CronScheduledTriggerFilter struct { 4 | CronExpression string `json:"CronExpression,omitempty"` 5 | 6 | scheduleTriggerFilter 7 | } 8 | 9 | func NewCronScheduledTriggerFilter(cronExpression string, timeZone string) *CronScheduledTriggerFilter { 10 | return &CronScheduledTriggerFilter{ 11 | CronExpression: cronExpression, 12 | scheduleTriggerFilter: *newScheduleTriggerFilter(CronExpressionSchedule, timeZone), 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pkg/filters/daily_scheduled_trigger_interval.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type DailyScheduledInterval int 4 | 5 | const ( 6 | OnceDaily DailyScheduledInterval = iota 7 | OnceHourly 8 | OnceEveryMinute 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/filters/feed_trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages" 4 | 5 | type FeedTriggerFilter struct { 6 | Packages []packages.DeploymentActionSlugPackage `json:"Packages,omitempty"` 7 | 8 | triggerFilter 9 | } 10 | 11 | func NewFeedTriggerFilter(packages []packages.DeploymentActionSlugPackage) *FeedTriggerFilter { 12 | return &FeedTriggerFilter{ 13 | Packages: packages, 14 | triggerFilter: *newTriggerFilter(FeedFilter), 15 | } 16 | } 17 | 18 | func (t *FeedTriggerFilter) GetFilterType() FilterType { 19 | return t.Type 20 | } 21 | 22 | func (t *FeedTriggerFilter) SetFilterType(filterType FilterType) { 23 | t.Type = filterType 24 | } 25 | 26 | var _ ITriggerFilter = &FeedTriggerFilter{} 27 | -------------------------------------------------------------------------------- /pkg/filters/filter_type.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type FilterType int 4 | 5 | const ( 6 | ContinuousDailySchedule FilterType = iota 7 | CronExpressionSchedule 8 | DailySchedule 9 | DaysPerMonthSchedule 10 | DaysPerWeekSchedule 11 | MachineFilter 12 | OnceDailySchedule 13 | FeedFilter 14 | GitFilter 15 | ) 16 | -------------------------------------------------------------------------------- /pkg/filters/git_trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type GitTriggerSource struct { 4 | DeploymentActionSlug string `json:"DeploymentActionSlug"` 5 | GitDependencyName string `json:"GitDependencyName"` 6 | IncludeFilePaths []string `json:"IncludeFilePaths"` 7 | ExcludeFilePaths []string `json:"ExcludeFilePaths"` 8 | } 9 | 10 | type GitTriggerFilter struct { 11 | Sources []GitTriggerSource `json:"Sources"` 12 | 13 | triggerFilter 14 | } 15 | 16 | func NewGitTriggerFilter(gitTriggerSources []GitTriggerSource) *GitTriggerFilter { 17 | return &GitTriggerFilter{ 18 | Sources: gitTriggerSources, 19 | triggerFilter: *newTriggerFilter(GitFilter), 20 | } 21 | } 22 | 23 | func (t *GitTriggerFilter) GetFilterType() FilterType { 24 | return t.Type 25 | } 26 | 27 | func (t *GitTriggerFilter) SetFilterType(filterType FilterType) { 28 | t.Type = filterType 29 | } 30 | 31 | var _ ITriggerFilter = &GitTriggerFilter{} 32 | -------------------------------------------------------------------------------- /pkg/filters/monthly_schedule.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type MonthlySchedule int 4 | 5 | const ( 6 | DateOfMonth MonthlySchedule = iota 7 | DayOfMonth 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/filters/schedule_trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type scheduleTriggerFilter struct { 4 | TimeZone string `json:"Timezone,omitempty"` 5 | 6 | triggerFilter 7 | } 8 | 9 | func newScheduleTriggerFilter(filterType FilterType, timeZone string) *scheduleTriggerFilter { 10 | return &scheduleTriggerFilter{ 11 | TimeZone: timeZone, 12 | triggerFilter: *newTriggerFilter(filterType), 13 | } 14 | } 15 | 16 | func (t *scheduleTriggerFilter) GetFilterType() FilterType { 17 | return t.Type 18 | } 19 | 20 | func (t *scheduleTriggerFilter) SetFilterType(filterType FilterType) { 21 | t.Type = filterType 22 | } 23 | 24 | var _ ITriggerFilter = &scheduleTriggerFilter{} 25 | -------------------------------------------------------------------------------- /pkg/filters/scheduled_trigger_filter_run_type.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type ScheduledTriggerFilterRunType int 4 | 5 | const ( 6 | ScheduledTime ScheduledTriggerFilterRunType = iota 7 | Continuously 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/filters/trigger_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | // ITriggerFilter defines the interface for trigger filters. 6 | type ITriggerFilter interface { 7 | GetFilterType() FilterType 8 | SetFilterType(filterType FilterType) 9 | } 10 | 11 | type triggerFilter struct { 12 | Type FilterType `json:"FilterType"` 13 | 14 | resources.Resource 15 | } 16 | 17 | func newTriggerFilter(filterType FilterType) *triggerFilter { 18 | return &triggerFilter{ 19 | Type: filterType, 20 | Resource: *resources.NewResource(), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/filters/weekday.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | type Weekday int 4 | 5 | const ( 6 | Sunday Weekday = iota 7 | Monday 8 | Tuesday 9 | Wednesday 10 | Thursday 11 | Friday 12 | Saturday 13 | ) 14 | -------------------------------------------------------------------------------- /pkg/gitdependencies/deployment_action_git_dependency.go: -------------------------------------------------------------------------------- 1 | package gitdependencies 2 | 3 | type DeploymentActionGitDependency struct { 4 | DeploymentActionSlug string `json:"DeploymentActionSlug,omitempty"` 5 | GitDependencyName string `json:"GitDependencyName,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/gitdependencies/git_dependency.go: -------------------------------------------------------------------------------- 1 | package gitdependencies 2 | 3 | type GitDependency struct { 4 | Name string `json:"Name" validate:"required,notblank"` 5 | RepositoryUri string `json:"RepositoryUri" validate:"required,notblank"` 6 | DefaultBranch string `json:"DefaultBranch" validate:"required,notblank"` 7 | GitCredentialType string `json:"GitCredentialType" validate:"required,notblank"` 8 | FilePathFilters []string `json:"FilePathFilters,omitempty"` 9 | GitCredentialId string `json:"GitCredentialId,omitempty"` 10 | StepPackageInputsReferenceId string `json:"StepPackageInputsReferenceId,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/gitdependencies/selected_git_reference.go: -------------------------------------------------------------------------------- 1 | package gitdependencies 2 | 3 | type SelectedGitResources struct { 4 | ActionName string `json:"ActionName,omitempty"` 5 | GitReference *GitReference `json:"GitReferenceResource,omitempty"` 6 | GitResourceReferenceName string `json:"GitResourceReferenceName,omitempty"` 7 | } 8 | 9 | type GitReference struct { 10 | GitRef string `json:"GitRef,omitempty"` 11 | GitCommit string `json:"GitCommit,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /pkg/interruptions/control.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | type Control interface{} 4 | -------------------------------------------------------------------------------- /pkg/interruptions/form.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | type Form struct { 4 | Elements []*FormElement `json:"Elements"` 5 | Values map[string]string `json:"Values,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/interruptions/form_element.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | type FormElement struct { 4 | Control Control `json:"Control,omitempty"` 5 | IsValueRequired *bool `json:"IsValueRequired"` 6 | Name string `json:"Name,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/interruptions/interruption_submit_request.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | type InterruptionSubmitRequest struct { 4 | Instructions string `json:"Instructions"` 5 | Notes string `json:"Notes"` 6 | Result string `json:"Result"` 7 | } 8 | 9 | func NewInterruptionSubmitRequest() *InterruptionSubmitRequest { 10 | return &InterruptionSubmitRequest{} 11 | } 12 | -------------------------------------------------------------------------------- /pkg/interruptions/interruptions_query.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | type InterruptionsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PendingOnly bool `uri:"pendingOnly,omitempty" url:"pendingOnly,omitempty"` 6 | Regarding string `uri:"regarding,omitempty" url:"regarding,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/interruptions/is_nil.go: -------------------------------------------------------------------------------- 1 | package interruptions 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Interruption: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/invitations/invitation_service.go: -------------------------------------------------------------------------------- 1 | package invitations 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type InvitationService struct { 10 | services.Service 11 | } 12 | 13 | func NewInvitationService(sling *sling.Sling, uriTemplate string) *InvitationService { 14 | return &InvitationService{ 15 | Service: services.NewService(constants.ServiceInvitationService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/issuetrackers/commit.go: -------------------------------------------------------------------------------- 1 | package issuetrackers 2 | 3 | type Commit struct { 4 | Comment string `json:"Comment,omitempty"` 5 | ID string `json:"Id,omitempty"` 6 | } 7 | 8 | func NewCommit() *Commit { 9 | return &Commit{} 10 | } 11 | -------------------------------------------------------------------------------- /pkg/issuetrackers/commit_details.go: -------------------------------------------------------------------------------- 1 | package issuetrackers 2 | 3 | type CommitDetails struct { 4 | Comment string `json:"Comment,omitempty"` 5 | ID string `json:"Id,omitempty"` 6 | LinkURL string `json:"LinkUrl,omitempty"` 7 | } 8 | 9 | func NewCommitDetails() *CommitDetails { 10 | return &CommitDetails{} 11 | } 12 | -------------------------------------------------------------------------------- /pkg/issuetrackers/issue_tracker_service.go: -------------------------------------------------------------------------------- 1 | package issuetrackers 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type IssueTrackerService struct { 10 | services.Service 11 | } 12 | 13 | func NewIssueTrackerService(sling *sling.Sling, uriTemplate string) *IssueTrackerService { 14 | return &IssueTrackerService{ 15 | Service: services.NewService(constants.ServiceIssueTrackerService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/issuetrackers/issue_trackers_query.go: -------------------------------------------------------------------------------- 1 | package issuetrackers 2 | 3 | type IssueTrackersQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/jira/jira_integration_service.go: -------------------------------------------------------------------------------- 1 | package jira 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type JiraIntegrationService struct { 10 | connectAppCredentialsTestPath string 11 | credentialsTestPath string 12 | 13 | services.Service 14 | } 15 | 16 | func NewJiraIntegrationService(sling *sling.Sling, uriTemplate string, connectAppCredentialsTestPath string, credentialsTestPath string) *JiraIntegrationService { 17 | return &JiraIntegrationService{ 18 | connectAppCredentialsTestPath: connectAppCredentialsTestPath, 19 | credentialsTestPath: credentialsTestPath, 20 | Service: services.NewService(constants.ServiceJiraIntegrationService, sling, uriTemplate), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/licenses/licenses_service.go: -------------------------------------------------------------------------------- 1 | package licenses 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type LicenseService struct { 10 | currentLicense string 11 | currentLicenseStatus string 12 | 13 | services.Service 14 | } 15 | 16 | func NewLicenseService(sling *sling.Sling, uriTemplate string, currentLicense string, currentLicenseStatus string) *LicenseService { 17 | return &LicenseService{ 18 | currentLicense: currentLicense, 19 | currentLicenseStatus: currentLicenseStatus, 20 | Service: services.NewService(constants.ServiceLicenseService, sling, uriTemplate), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/lifecycles/is_nil.go: -------------------------------------------------------------------------------- 1 | package lifecycles 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Lifecycle: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/lifecycles/query.go: -------------------------------------------------------------------------------- 1 | package lifecycles 2 | 3 | type Query struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machinepolicies/machine_connectivity_policy.go: -------------------------------------------------------------------------------- 1 | package machinepolicies 2 | 3 | type MachineConnectivityPolicy struct { 4 | MachineConnectivityBehavior string `json:"MachineConnectivityBehavior" validate:"oneof=ExpectedToBeOnline MayBeOfflineAndCanBeSkipped"` 5 | } 6 | 7 | func NewMachineConnectivityPolicy() *MachineConnectivityPolicy { 8 | return &MachineConnectivityPolicy{ 9 | MachineConnectivityBehavior: "ExpectedToBeOnline", 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pkg/machinepolicies/machine_policies_query.go: -------------------------------------------------------------------------------- 1 | package machinepolicies 2 | 3 | type MachinePoliciesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machinepolicies/machine_script_policy.go: -------------------------------------------------------------------------------- 1 | package machinepolicies 2 | 3 | type MachineScriptPolicy struct { 4 | RunType string `json:"RunType" validate:"required,oneof=InheritFromDefault Inline OnlyConnectivity"` 5 | ScriptBody *string `json:"ScriptBody"` 6 | } 7 | 8 | func NewMachineScriptPolicy() *MachineScriptPolicy { 9 | return &MachineScriptPolicy{ 10 | RunType: "InheritFromDefault", 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/machinepolicies/machine_update_policy.go: -------------------------------------------------------------------------------- 1 | package machinepolicies 2 | 3 | type MachineUpdatePolicy struct { 4 | CalamariUpdateBehavior string `json:"CalamariUpdateBehavior" validate:"required,oneof=UpdateAlways UpdateOnDeployment UpdateOnNewMachine"` 5 | TentacleUpdateAccountID string `json:"TentacleUpdateAccountId,omitempty"` 6 | TentacleUpdateBehavior string `json:"TentacleUpdateBehavior" validate:"required,oneof=NeverUpdate Update"` 7 | KubernetesAgentUpdateBehavior string `json:"KubernetesAgentUpdateBehavior" validate:"required,oneof=NeverUpdate Update"` 8 | } 9 | 10 | func NewMachineUpdatePolicy() *MachineUpdatePolicy { 11 | return &MachineUpdatePolicy{ 12 | CalamariUpdateBehavior: "UpdateOnDeployment", 13 | TentacleUpdateBehavior: "NeverUpdate", 14 | KubernetesAgentUpdateBehavior: "Update", 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pkg/machines/activity_log_element.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import "time" 4 | 5 | // ActivityLogElement represents an activity log element. 6 | type ActivityLogElement struct { 7 | Category string `json:"Category,omitempty"` 8 | Detail string `json:"Detail,omitempty"` 9 | MessageText string `json:"MessageText,omitempty"` 10 | OccurredAt time.Time `json:"OccurredAt,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/machines/activity_log_entry.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // ActivityLogEntry represents an activity log entry. 8 | type ActivityLogEntry struct { 9 | Category string `json:"Category,omitempty" validate:"required,oneof=Abandoned Alert Error Fatal Finished Gap Highlight Info Planned Trace Updated Verbose Wait Warning"` 10 | Detail string `json:"Detail,omitempty"` 11 | MessageText string `json:"MessageText,omitempty"` 12 | OccurredAt time.Time `json:"OccurredAt,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/machines/azure_web_app_endpoint.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | // AzureWebAppEndpoint represents the an Azure web app-based endpoint. 6 | type AzureWebAppEndpoint struct { 7 | AccountID string `json:"AccountId"` 8 | ResourceGroupName string `json:"ResourceGroupName,omitempty"` 9 | WebAppName string `json:"WebAppName,omitempty"` 10 | WebAppSlotName string `json:"WebAppSlotName"` 11 | 12 | endpoint 13 | } 14 | 15 | // NewAzureWebAppEndpoint creates a new endpoint for Azure web apps. 16 | func NewAzureWebAppEndpoint() *AzureWebAppEndpoint { 17 | azureWebAppEndpoint := &AzureWebAppEndpoint{ 18 | endpoint: *newEndpoint("AzureWebApp"), 19 | } 20 | 21 | return azureWebAppEndpoint 22 | } 23 | 24 | var _ resources.IResource = &AzureWebAppEndpoint{} 25 | var _ IEndpoint = &AzureWebAppEndpoint{} 26 | -------------------------------------------------------------------------------- /pkg/machines/cloud_service_endpoint.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type CloudServiceEndpoint struct { 4 | CloudServiceName string `json:"CloudServiceName,omitempty"` 5 | Slot string `json:"Slot,omitempty"` 6 | StorageAccountName string `json:"StorageAccountName,omitempty"` 7 | SwapIfPossible bool `json:"SwapIfPossible"` 8 | UseCurrentInstanceCount bool `json:"UseCurrentInstanceCount"` 9 | 10 | endpoint 11 | } 12 | 13 | func NewCloudServiceEndpoint() *CloudServiceEndpoint { 14 | cloudServiceEndpoint := &CloudServiceEndpoint{ 15 | endpoint: *newEndpoint("None"), 16 | } 17 | return cloudServiceEndpoint 18 | } 19 | -------------------------------------------------------------------------------- /pkg/machines/discover_machine_query.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type DiscoverMachineQuery struct { 4 | Host string `uri:"host,omitempty" url:"host,omitempty"` 5 | Port int `uri:"port,omitempty" url:"port,omitempty"` 6 | ProxyID string `uri:"proxyId,omitempty" url:"proxyId,omitempty"` 7 | Type string `uri:"type,omitempty" url:"type,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machines/discover_worker_query.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type DiscoverWorkerQuery struct { 4 | Host string `uri:"host,omitempty" url:"host,omitempty"` 5 | Port int `uri:"port,omitempty" url:"port,omitempty"` 6 | ProxyID string `uri:"proxyId,omitempty" url:"proxyId,omitempty"` 7 | Type string `uri:"type,omitempty" url:"type,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machines/endpoint_test.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestEndpointNew(t *testing.T) { 10 | testCases := []struct { 11 | name string 12 | communicationStyle string 13 | }{ 14 | {"Valid", "TentaclePassive"}, 15 | {"Valid", "None"}, 16 | } 17 | for _, tc := range testCases { 18 | t.Run(tc.name, func(t *testing.T) { 19 | endpoint := &endpoint{ 20 | CommunicationStyle: tc.communicationStyle, 21 | } 22 | assert.NoError(t, endpoint.Validate()) 23 | 24 | endpoint = newEndpoint(tc.communicationStyle) 25 | assert.NoError(t, endpoint.Validate()) 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/machines/endpoint_with_account.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type IEndpointWithAccount interface { 4 | GetAccountID() string 5 | } 6 | -------------------------------------------------------------------------------- /pkg/machines/endpoint_with_proxy.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type IEndpointWithProxy interface { 4 | GetProxyID() string 5 | SetProxyID(string) 6 | } 7 | -------------------------------------------------------------------------------- /pkg/machines/get_random_duration.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "fmt" 5 | "math/rand" 6 | "time" 7 | ) 8 | 9 | func getRandomDuration(minimum int64) time.Duration { 10 | duration, _ := time.ParseDuration(fmt.Sprintf("%ds", rand.Int63n(1000)+minimum)) 11 | return duration 12 | } 13 | -------------------------------------------------------------------------------- /pkg/machines/is_nil.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *AzureCloudServiceEndpoint: 6 | return v == nil 7 | case *AzureServiceFabricEndpoint: 8 | return v == nil 9 | case *AzureWebAppEndpoint: 10 | return v == nil 11 | case *CloudRegionEndpoint: 12 | return v == nil 13 | case *CloudServiceEndpoint: 14 | return v == nil 15 | case *DeploymentTarget: 16 | return v == nil 17 | case *EndpointResource: 18 | return v == nil 19 | case *KubernetesEndpoint: 20 | return v == nil 21 | case *ListeningTentacleEndpoint: 22 | return v == nil 23 | case *MachineConnectionStatus: 24 | return v == nil 25 | case *MachinePolicy: 26 | return v == nil 27 | case *PollingTentacleEndpoint: 28 | return v == nil 29 | case *SSHEndpoint: 30 | return v == nil 31 | case *Worker: 32 | return v == nil 33 | default: 34 | return v == nil 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_agent_details.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesAgentDetails struct { 4 | AgentVersion string `json:"AgentVersion"` 5 | TentacleVersion string `json:"TentacleVersion"` 6 | UpgradeStatus string `json:"UpgradeStatus" validate:"oneof=NoUpgrades UpgradeAvailable UpgradeSuggested UpgradeRequired"` 7 | HelmReleaseName string `json:"HelmReleaseName"` 8 | KubernetesNamespace string `json:"KubernetesNamespace"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_aws_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesAwsAuthentication struct { 4 | AssumedRoleARN string `json:"AssumedRoleArn,omitempty"` 5 | AssumedRoleSession string `json:"AssumedRoleSession,omitempty"` 6 | AssumeRole bool `json:"AssumeRole"` 7 | AssumeRoleExternalID string `json:"AssumeRoleExternalId,omitempty"` 8 | AssumeRoleSessionDuration int `json:"AssumeRoleSessionDurationSeconds,omitempty"` 9 | ClusterName string `json:"ClusterName,omitempty"` 10 | UseInstanceRole bool `json:"UseInstanceRole"` 11 | 12 | KubernetesStandardAuthentication 13 | } 14 | 15 | // NewKubernetesAwsAuthentication creates and initializes a Kubernetes AWS 16 | // authentication. 17 | func NewKubernetesAwsAuthentication() *KubernetesAwsAuthentication { 18 | return &KubernetesAwsAuthentication{ 19 | KubernetesStandardAuthentication: *NewKubernetesStandardAuthentication("KubernetesAws"), 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_azure_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesAzureAuthentication struct { 4 | ClusterName string `json:"ClusterName,omitempty"` 5 | ClusterResourceGroup string `json:"ClusterResourceGroup,omitempty"` 6 | AdminLogin string `json:"AdminLogin,omitempty"` 7 | 8 | KubernetesStandardAuthentication 9 | } 10 | 11 | // NewKubernetesAzureAuthentication creates and initializes a Kubernetes Azure 12 | // authentication. 13 | func NewKubernetesAzureAuthentication() *KubernetesAzureAuthentication { 14 | return &KubernetesAzureAuthentication{ 15 | KubernetesStandardAuthentication: *NewKubernetesStandardAuthentication("KubernetesAzure"), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_certificate_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesCertificateAuthentication struct { 4 | AuthenticationType string `json:"AuthenticationType"` 5 | ClientCertificate string `json:"ClientCertificate,omitempty"` 6 | } 7 | 8 | // NewKubernetesCertificateAuthentication creates and initializes a Kubernetes 9 | // certificate authentication. 10 | func NewKubernetesCertificateAuthentication() *KubernetesCertificateAuthentication { 11 | return &KubernetesCertificateAuthentication{ 12 | AuthenticationType: "KubernetesCertificate", 13 | } 14 | } 15 | 16 | // GetAuthenticationType returns the authentication type of this 17 | // Kubernetes-based authentication. 18 | func (k *KubernetesCertificateAuthentication) GetAuthenticationType() string { 19 | return k.AuthenticationType 20 | } 21 | 22 | var _ IKubernetesAuthentication = &KubernetesCertificateAuthentication{} 23 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_gcp_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesGcpAuthentication struct { 4 | ClusterName string `json:"ClusterName,omitempty"` 5 | ImpersonateServiceAccount bool `json:"ImpersonateServiceAccount"` 6 | Project string `json:"Project,omitempty"` 7 | Region string `json:"Region,omitempty"` 8 | ServiceAccountEmails string `json:"ServiceAccountEmails,omitempty"` 9 | UseVmServiceAccount bool `json:"UseVmServiceAccount"` 10 | Zone string `json:"Zone,omitempty"` 11 | 12 | KubernetesStandardAuthentication 13 | } 14 | 15 | // NewKubernetesGcpAuthentication creates and initializes a Kubernetes GCP 16 | // authentication. 17 | func NewKubernetesGcpAuthentication() *KubernetesGcpAuthentication { 18 | return &KubernetesGcpAuthentication{ 19 | KubernetesStandardAuthentication: *NewKubernetesStandardAuthentication("KubernetesGoogleCloud"), 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_pod_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesPodAuthentication struct { 4 | TokenPath string `json:"TokenPath,omitempty"` 5 | AuthenticationType string `json:"AuthenticationType"` 6 | } 7 | 8 | // NewKubernetesPodAuthentication creates and initializes a Kubernetes 9 | // authentication. 10 | func NewKubernetesPodAuthentication() *KubernetesPodAuthentication { 11 | authenticationType := "KubernetesPodService" 12 | return &KubernetesPodAuthentication{ 13 | AuthenticationType: authenticationType, 14 | } 15 | } 16 | 17 | // GetAuthenticationType returns the authentication type of this 18 | // Kubernetes-based authentication. 19 | func (k *KubernetesPodAuthentication) GetAuthenticationType() string { 20 | return k.AuthenticationType 21 | } 22 | 23 | var _ IKubernetesAuthentication = &KubernetesPodAuthentication{} 24 | -------------------------------------------------------------------------------- /pkg/machines/kubernetes_standard_authentication.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type KubernetesStandardAuthentication struct { 4 | AccountID string `json:"AccountId,omitempty"` 5 | AuthenticationType string `json:"AuthenticationType"` 6 | } 7 | 8 | // NewKubernetesStandardAuthentication creates and initializes a Kubernetes 9 | // authentication. 10 | func NewKubernetesStandardAuthentication(authenticationType string) *KubernetesStandardAuthentication { 11 | if len(authenticationType) == 0 { 12 | authenticationType = "KubernetesStandard" 13 | } 14 | 15 | return &KubernetesStandardAuthentication{ 16 | AuthenticationType: authenticationType, 17 | } 18 | } 19 | 20 | // GetAuthenticationType returns the authentication type of this 21 | // Kubernetes-based authentication. 22 | func (k *KubernetesStandardAuthentication) GetAuthenticationType() string { 23 | return k.AuthenticationType 24 | } 25 | 26 | var _ IKubernetesAuthentication = &KubernetesStandardAuthentication{} 27 | -------------------------------------------------------------------------------- /pkg/machines/machine_connection_status.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 7 | ) 8 | 9 | type MachineConnectionStatus struct { 10 | CurrentTentacleVersion string `json:"CurrentTentacleVersion,omitempty"` 11 | LastChecked time.Time `json:"LastChecked,omitempty"` 12 | Logs []*ActivityLogElement `json:"Logs"` 13 | MachineID string `json:"MachineId,omitempty"` 14 | Status string `json:"Status,omitempty"` 15 | 16 | resources.Resource 17 | } 18 | 19 | func NewMachineConnectionStatus() *MachineConnectionStatus { 20 | return &MachineConnectionStatus{ 21 | Resource: *resources.NewResource(), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pkg/machines/machine_connectivity_policy.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type MachineConnectivityPolicy struct { 4 | MachineConnectivityBehavior string `json:"MachineConnectivityBehavior" validate:"oneof=ExpectedToBeOnline MayBeOfflineAndCanBeSkipped"` 5 | } 6 | 7 | func NewMachineConnectivityPolicy() *MachineConnectivityPolicy { 8 | return &MachineConnectivityPolicy{ 9 | MachineConnectivityBehavior: "ExpectedToBeOnline", 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pkg/machines/machine_policies_query.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type MachinePoliciesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machines/machine_role_service.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services/api" 7 | "github.com/dghubble/sling" 8 | ) 9 | 10 | type MachineRoleService struct { 11 | services.Service 12 | } 13 | 14 | func NewMachineRoleService(sling *sling.Sling, uriTemplate string) *MachineRoleService { 15 | return &MachineRoleService{ 16 | Service: services.NewService(constants.ServiceMachineRoleService, sling, uriTemplate), 17 | } 18 | } 19 | 20 | func (s *MachineRoleService) GetAll() ([]*string, error) { 21 | items := []*string{} 22 | path, err := services.GetPath(s) 23 | if err != nil { 24 | return nil, err 25 | } 26 | 27 | _, err = api.ApiGet(s.GetClient(), &items, path) 28 | return items, err 29 | } 30 | -------------------------------------------------------------------------------- /pkg/machines/machine_script_policy.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type MachineScriptPolicy struct { 4 | RunType string `json:"RunType" validate:"required,oneof=InheritFromDefault Inline OnlyConnectivity"` 5 | ScriptBody *string `json:"ScriptBody"` 6 | } 7 | 8 | func NewMachineScriptPolicy() *MachineScriptPolicy { 9 | return &MachineScriptPolicy{ 10 | RunType: "InheritFromDefault", 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/machines/machine_tentacle_version_details.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type MachineTentacleVersionDetails struct { 4 | UpgradeLocked bool `json:"UpgradeLocked"` 5 | Version string `json:"Version"` 6 | UpgradeSuggested bool `json:"UpgradeSuggested"` 7 | UpgradeRequired bool `json:"UpgradeRequired"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/machines/machine_test.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import ( 4 | "net/url" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestEmptyMachine(t *testing.T) { 12 | machine := &machine{} 13 | require.NotNil(t, machine) 14 | require.Error(t, machine.Validate()) 15 | } 16 | 17 | func TestKubernetesEndpoint(t *testing.T) { 18 | url, err := url.Parse("https://example.com/") 19 | require.NoError(t, err) 20 | require.NotNil(t, url) 21 | 22 | machine := &machine{ 23 | Endpoint: NewKubernetesEndpoint(url), 24 | } 25 | assert.NotNil(t, machine) 26 | assert.NoError(t, machine.Validate()) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/machines/machine_update_policy.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type MachineUpdatePolicy struct { 4 | CalamariUpdateBehavior string `json:"CalamariUpdateBehavior" validate:"required,oneof=UpdateAlways UpdateOnDeployment UpdateOnNewMachine"` 5 | TentacleUpdateAccountID string `json:"TentacleUpdateAccountId,omitempty"` 6 | TentacleUpdateBehavior string `json:"TentacleUpdateBehavior" validate:"required,oneof=NeverUpdate Update"` 7 | KubernetesAgentUpdateBehavior string `json:"KubernetesAgentUpdateBehavior" validate:"required,oneof=NeverUpdate Update"` 8 | } 9 | 10 | func NewMachineUpdatePolicy() *MachineUpdatePolicy { 11 | return &MachineUpdatePolicy{ 12 | CalamariUpdateBehavior: "UpdateOnDeployment", 13 | TentacleUpdateBehavior: "NeverUpdate", 14 | KubernetesAgentUpdateBehavior: "Update", 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pkg/machines/offline_package_drop_destination.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type OfflinePackageDropDestination struct { 4 | DestinationType string `json:"DestinationType" validate:"oneof=Artifact FileSystem"` 5 | DropFolderPath string `json:"DropFolderPath,omitempty"` 6 | } 7 | 8 | func NewOfflinePackageDropDestination() *OfflinePackageDropDestination { 9 | return &OfflinePackageDropDestination{ 10 | DestinationType: "Artifact", 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/machines/offline_package_drop_endpoint.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 4 | 5 | type OfflinePackageDropEndpoint struct { 6 | ApplicationsDirectory string `json:"ApplicationsDirectory,omitempty"` 7 | Destination *OfflinePackageDropDestination `json:"Destination"` 8 | SensitiveVariablesEncryptionPassword *core.SensitiveValue `json:"SensitiveVariablesEncryptionPassword"` 9 | WorkingDirectory string `json:"OctopusWorkingDirectory,omitempty"` 10 | 11 | endpoint 12 | } 13 | 14 | func NewOfflinePackageDropEndpoint() *OfflinePackageDropEndpoint { 15 | return &OfflinePackageDropEndpoint{ 16 | Destination: NewOfflinePackageDropDestination(), 17 | endpoint: *newEndpoint("OfflineDrop"), 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/machines/runs_on_a_worker.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | // IRunsOnAWorker defines the interface for workers. 4 | type IRunsOnAWorker interface { 5 | GetDefaultWorkerPoolID() string 6 | SetDefaultWorkerPoolID(string) 7 | } 8 | -------------------------------------------------------------------------------- /pkg/machines/tentacle_version_details.go: -------------------------------------------------------------------------------- 1 | package machines 2 | 3 | type TentacleVersionDetails struct { 4 | UpgradeLocked bool `json:"UpgradeLocked"` 5 | UpgradeSuggested bool `json:"UpgradeSuggested"` 6 | UpgradeRequired bool `json:"UpgradeRequired"` 7 | Version string `json:"Version"` 8 | } 9 | 10 | // NewTentacleVersionDetails creates and initializes tentacle version details. 11 | func NewTentacleVersionDetails(version string, upgradeLocked bool, upgradeSuggested bool, upgradeRequired bool) *TentacleVersionDetails { 12 | return &TentacleVersionDetails{ 13 | Version: version, 14 | UpgradeLocked: upgradeLocked, 15 | UpgradeSuggested: upgradeSuggested, 16 | UpgradeRequired: upgradeRequired, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pkg/metadata/display_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 4 | 5 | type DisplayInfo struct { 6 | ConnectivityCheck *core.ConnectivityCheck `json:"ConnectivityCheck,omitempty"` 7 | Description string `json:"Description,omitempty"` 8 | Label string `json:"Label,omitempty"` 9 | ListAPI *ListAPIMetadata `json:"ListApi,omitempty"` 10 | Options *OptionsMetadata `json:"Options,omitempty"` 11 | PropertyApplicability *PropertyApplicability `json:"PropertyApplicability,omitempty"` 12 | ReadOnly bool `json:"ReadOnly"` 13 | Required bool `json:"Required"` 14 | ShowCopyToClipboard bool `json:"ShowCopyToClipboard"` 15 | } 16 | 17 | func NewDisplayInfo() *DisplayInfo { 18 | return &DisplayInfo{} 19 | } 20 | -------------------------------------------------------------------------------- /pkg/metadata/list_api_metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | type ListAPIMetadata struct { 4 | APIEndpoint string `json:"ApiEndpoint,omitempty"` 5 | SelectMode string `json:"SelectMode,omitempty"` 6 | } 7 | 8 | func NewListAPIMetadata() *ListAPIMetadata { 9 | return &ListAPIMetadata{} 10 | } 11 | -------------------------------------------------------------------------------- /pkg/metadata/metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | type Metadata struct { 4 | Description string `json:"Description,omitempty"` 5 | Types []*TypeMetadata `json:"Types"` 6 | } 7 | 8 | func NewMetadata() *Metadata { 9 | return &Metadata{} 10 | } 11 | -------------------------------------------------------------------------------- /pkg/metadata/options_metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | type OptionsMetadata struct { 4 | SelectMode string `json:"SelectMode,omitempty"` 5 | Values map[string]string `json:"Values,omitempty"` 6 | } 7 | 8 | func NewOptionsMetadata() *OptionsMetadata { 9 | return &OptionsMetadata{} 10 | } 11 | -------------------------------------------------------------------------------- /pkg/metadata/property_applicability.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | import "github.com/go-playground/validator/v10" 4 | 5 | type PropertyApplicability struct { 6 | DependsOnPropertyName string `json:"DependsOnPropertyName,omitempty"` 7 | DependsOnPropertyValue interface{} `json:"DependsOnPropertyValue,omitempty"` 8 | Mode string `json:"Mode,omitempty" validate:"required,oneof=ApplicableIfHasAnyValue ApplicableIfHasNoValue ApplicableIfNotSpecificValue ApplicableIfSpecificValue"` 9 | } 10 | 11 | func NewPropertyApplicability() *PropertyApplicability { 12 | return &PropertyApplicability{} 13 | } 14 | 15 | // Validate checks the state of the property applicability and returns an error 16 | // if invalid. 17 | func (p PropertyApplicability) Validate() error { 18 | return validator.New().Struct(p) 19 | } 20 | -------------------------------------------------------------------------------- /pkg/metadata/property_metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | type PropertyMetadata struct { 4 | DisplayInfo *DisplayInfo `json:"DisplayInfo,omitempty"` 5 | Name string `json:"Name,omitempty"` 6 | Type string `json:"Type,omitempty"` 7 | } 8 | 9 | func NewPropertyMetadata() *PropertyMetadata { 10 | return &PropertyMetadata{} 11 | } 12 | -------------------------------------------------------------------------------- /pkg/metadata/type_metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | type TypeMetadata struct { 4 | Name string `json:"Name,omitempty"` 5 | Properties []*PropertyMetadata `json:"Properties"` 6 | } 7 | 8 | func NewTypeMetadata() *TypeMetadata { 9 | return &TypeMetadata{} 10 | } 11 | -------------------------------------------------------------------------------- /pkg/migrations/migration_service.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type MigrationService struct { 10 | migrationsImportPath string 11 | migrationsPartialExportPath string 12 | 13 | services.Service 14 | } 15 | 16 | func NewMigrationService(sling *sling.Sling, uriTemplate string, migrationsImportPath string, migrationsPartialExportPath string) *MigrationService { 17 | return &MigrationService{ 18 | migrationsImportPath: migrationsImportPath, 19 | migrationsPartialExportPath: migrationsPartialExportPath, 20 | Service: services.NewService(constants.ServiceMigrationService, sling, uriTemplate), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/octopusservernodes/octopus_server_node.go: -------------------------------------------------------------------------------- 1 | package octopusservernodes 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type OctopusServerNodeResource struct { 6 | IsInMaintenanceMode bool `json:"IsInMaintenanceMode"` 7 | MaxConcurrentTasks int32 `json:"MaxConcurrentTasks,omitempty"` 8 | Name string `json:"Name,omitempty"` 9 | 10 | resources.Resource 11 | } 12 | 13 | func NewOctopusServerNodeResource() *OctopusServerNodeResource { 14 | return &OctopusServerNodeResource{ 15 | Resource: *resources.NewResource(), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/octopusservernodes/octopus_server_nodes_query.go: -------------------------------------------------------------------------------- 1 | package octopusservernodes 2 | 3 | type OctopusServerNodesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/octopusservernodes/octopus_server_nodes_service.go: -------------------------------------------------------------------------------- 1 | package octopusservernodes 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type OctopusServerNodeService struct { 10 | clusterSummaryPath string 11 | 12 | services.CanDeleteService 13 | } 14 | 15 | func NewOctopusServerNodeService(sling *sling.Sling, uriTemplate string, clusterSummaryPath string) *OctopusServerNodeService { 16 | return &OctopusServerNodeService{ 17 | clusterSummaryPath: clusterSummaryPath, 18 | CanDeleteService: services.CanDeleteService{ 19 | Service: services.NewService(constants.ServiceOctopusServerNodeService, sling, uriTemplate), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/packages/deployment_action_package.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type DeploymentActionPackage struct { 4 | DeploymentAction string `json:"DeploymentAction,omitempty"` 5 | PackageReference string `json:"PackageReference,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/packages/deployment_action_slug_package.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type DeploymentActionSlugPackage struct { 4 | DeploymentActionSlug string `json:"DeploymentActionSlug,omitempty"` 5 | PackageReference string `json:"PackageReference,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/packages/is_nil.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *DeploymentActionPackage: 6 | return v == nil 7 | case *Package: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/packages/octopus_package_metadata_service.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 4 | 5 | type OctopusPackageMetadataService struct { 6 | services.Service 7 | } 8 | -------------------------------------------------------------------------------- /pkg/packages/overwrite_mode.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type OverwriteMode string 4 | 5 | const ( 6 | OverwriteModeFailIfExists = OverwriteMode("FailIfExists") 7 | OverwriteModeIgnoreIfExists = OverwriteMode("IgnoreIfExists") 8 | OverwriteModeOverwriteExisting = OverwriteMode("OverwriteExisting") 9 | ) 10 | -------------------------------------------------------------------------------- /pkg/packages/package_delta_signature_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageDeltaSignatureQuery struct { 4 | PackageID string `uri:"packageId,omitempty" url:"packageId,omitempty"` 5 | Version string `uri:"version,omitempty" url:"version,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/packages/package_delta_upload_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageDeltaUploadQuery struct { 4 | BaseVersion string `uri:"baseVersion,omitempty" url:"baseVersion,omitempty"` 5 | OverwriteMode string `uri:"overwriteMode,omitempty" url:"overwriteMode,omitempty"` 6 | PackageID string `uri:"packageId,omitempty" url:"packageId,omitempty"` 7 | Replace bool `uri:"replace,omitempty" url:"replace,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/packages/package_description.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type PackageDescription struct { 6 | Description string `json:"Description,omitempty"` 7 | LatestVersion string `json:"LatestVersion,omitempty"` 8 | Name string `json:"Name,omitempty"` 9 | 10 | resources.Resource 11 | } 12 | -------------------------------------------------------------------------------- /pkg/packages/package_metadata_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageMetadataQuery struct { 4 | Filter string `uri:"filter,omitempty" url:"filter,omitempty"` 5 | Latest string `uri:"latest,omitempty" url:"latest,omitempty"` 6 | OverwriteMode string `uri:"overwriteMode,omitempty" url:"overwriteMode,omitempty"` 7 | Replace bool `uri:"replace,omitempty" url:"replace,omitempty"` 8 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/packages/package_metadata_service.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type PackageMetadataService struct { 10 | services.Service 11 | } 12 | 13 | func NewPackageMetadataService(sling *sling.Sling, uriTemplate string) *PackageMetadataService { 14 | return &PackageMetadataService{ 15 | Service: services.NewService(constants.ServicePackageMetadataService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/packages/package_note.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageNote struct { 4 | FeedID string `json:"FeedId,omitempty"` 5 | Notes *PackageNotesResult `json:"Notes,omitempty"` 6 | PackageID string `json:"PackageId,omitempty"` 7 | Version string `json:"Version,omitempty"` 8 | } 9 | 10 | func NewPackageNote() *PackageNote { 11 | return &PackageNote{} 12 | } 13 | -------------------------------------------------------------------------------- /pkg/packages/package_notes_list_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageNotesListQuery struct { 4 | PackageIDs []string `uri:"packageIds,omitempty" url:"packageIds,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/packages/package_notes_result.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageNotesResult struct { 4 | DisplayMessage string `json:"DisplayMessage,omitempty"` 5 | FailureReason string `json:"FailureReason,omitempty"` 6 | Notes string `json:"Notes,omitempty"` 7 | Succeeded bool `json:"Succeeded"` 8 | } 9 | 10 | func NewPackageNotesResult() *PackageNotesResult { 11 | return &PackageNotesResult{} 12 | } 13 | -------------------------------------------------------------------------------- /pkg/packages/package_reference.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageReference struct { 4 | AcquisitionLocation string `json:"AcquisitionLocation"` // This can be an expression 5 | FeedID string `json:"FeedId"` 6 | ID string `json:"Id,omitempty"` 7 | Name string `json:"Name,omitempty"` 8 | PackageID string `json:"PackageId,omitempty"` 9 | Properties map[string]string `json:"Properties"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/packages/package_upload.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 7 | ) 8 | 9 | // PackageUploadResponse represents the data returned by the Octopus server after uploading a package 10 | type PackageUploadResponse struct { 11 | PackageSizeBytes int 12 | Hash string 13 | NuGetPackageId string 14 | PackageId string 15 | NuGetFeedId string 16 | FeedId string 17 | Title string 18 | Summary string 19 | Version string 20 | Description string 21 | Published *time.Time 22 | ReleaseNotes string 23 | FileExtension string 24 | // PackageVersionBuildInformation buildinformation.PackageVersionBuildInformation 25 | 26 | resources.Resource 27 | } 28 | -------------------------------------------------------------------------------- /pkg/packages/package_upload_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackageUploadQuery struct { 4 | Replace bool `uri:"replace,omitempty" url:"replace,omitempty"` 5 | OverwriteMode string `uri:"overwriteMode,omitempty" url:"overwriteMode,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/packages/package_version.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 7 | ) 8 | 9 | type PackageVersion struct { 10 | FeedID string `json:"FeedId,omitempty"` 11 | PackageID string `json:"PackageId,omitempty"` 12 | Published time.Time `json:"Published,omitempty"` 13 | ReleaseNotes string `json:"ReleaseNotes,omitempty"` 14 | SizeBytes int64 `json:"SizeBytes,omitempty"` 15 | Title string `json:"Title,omitempty"` 16 | Version string `json:"Version,omitempty"` 17 | 18 | resources.Resource 19 | } 20 | 21 | func NewPackageVersion() *PackageVersion { 22 | return &PackageVersion{ 23 | Resource: *resources.NewResource(), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pkg/packages/packages_bulk_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackagesBulkQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/packages/packages_query.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type PackagesQuery struct { 4 | Filter string `uri:"filter,omitempty" url:"filter,omitempty"` 5 | IncludeNotes bool `uri:"includeNotes,omitempty" url:"includeNotes,omitempty"` 6 | Latest string `uri:"latest,omitempty" url:"latest,omitempty"` 7 | NuGetPackageID string `uri:"nuGetPackageId,omitempty" url:"nuGetPackageId,omitempty"` 8 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/packages/selected_package.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | type SelectedPackage struct { 4 | ActionName string `json:"ActionName,omitempty"` 5 | PackageReferenceName string `json:"PackageReferenceName,omitempty"` 6 | StepName string `json:"StepName,omitempty"` 7 | Version string `json:"Version,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/permissions/permission_description.go: -------------------------------------------------------------------------------- 1 | package permissions 2 | 3 | type PermissionDescription struct { 4 | CanApplyAtSpaceLevel *bool `json:"CanApplyAtSpaceLevel"` 5 | CanApplyAtSystemLevel *bool `json:"CanApplyAtSystemLevel"` 6 | Description string `json:"Description,omitempty"` 7 | SupportedRestrictions []string `json:"SupportedRestrictions"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/permissions/permission_service.go: -------------------------------------------------------------------------------- 1 | package permissions 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type PermissionService struct { 10 | services.Service 11 | } 12 | 13 | func NewPermissionService(sling *sling.Sling, uriTemplate string) *PermissionService { 14 | return &PermissionService{ 15 | Service: services.NewService(constants.ServicePermissionService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/permissions/projected_team_reference_data_item.go: -------------------------------------------------------------------------------- 1 | package permissions 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 4 | 5 | type ProjectedTeamReferenceDataItem struct { 6 | ExternalSecurityGroups []core.NamedReferenceItem `json:"ExternalSecurityGroups"` 7 | ID string `json:"Id,omitempty"` 8 | IsDirectlyAssigned bool `json:"IsDirectlyAssigned"` 9 | Name string `json:"Name,omitempty"` 10 | SpaceID string `json:"SpaceId,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/permissions/user_permission_restriction.go: -------------------------------------------------------------------------------- 1 | package permissions 2 | 3 | type UserPermissionRestriction struct { 4 | RestrictedToEnvironmentIds []string `json:"RestrictedToEnvironmentIds"` 5 | RestrictedToProjectGroupIds []string `json:"RestrictedToProjectGroupIds"` 6 | RestrictedToProjectIds []string `json:"RestrictedToProjectIds"` 7 | RestrictedToTenantIds []string `json:"RestrictedToTenantIds"` 8 | SpaceID string `json:"SpaceId,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/permissions/user_permission_set.go: -------------------------------------------------------------------------------- 1 | package permissions 2 | 3 | type UserPermissionSet struct { 4 | ID string `json:"Id"` 5 | IsPermissionsComplete bool `json:"IsPermissionsComplete"` 6 | IsTeamsComplete bool `json:"IsTeamsComplete"` 7 | Links map[string]string `json:"Links,omitempty"` 8 | SpacePermissions SpacePermissions `json:"SpacePermissions,omitempty"` 9 | SystemPermissions []string `json:"SystemPermissions"` 10 | Teams []ProjectedTeamReferenceDataItem `json:"Teams"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/projectgroups/is_nil.go: -------------------------------------------------------------------------------- 1 | package projectgroups 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *ProjectGroup: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/projectgroups/project_group.go: -------------------------------------------------------------------------------- 1 | package projectgroups 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type ProjectGroup struct { 6 | Description string `json:"Description,omitempty"` 7 | EnvironmentIDs []string `json:"EnvironmentIds,omitempty"` 8 | Name string `json:"Name,omitempty" validate:"required"` 9 | RetentionPolicyID string `json:"RetentionPolicyId,omitempty"` 10 | SpaceID string `json:"SpaceId,omitempty"` 11 | 12 | resources.Resource 13 | } 14 | 15 | func NewProjectGroup(name string) *ProjectGroup { 16 | return &ProjectGroup{ 17 | Name: name, 18 | Resource: *resources.NewResource(), 19 | } 20 | } 21 | 22 | func (s *ProjectGroup) GetName() string { 23 | return s.Name 24 | } 25 | -------------------------------------------------------------------------------- /pkg/projectgroups/project_groups_query.go: -------------------------------------------------------------------------------- 1 | package projectgroups 2 | 3 | type ProjectGroupsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/projects/auto_deploy_release_override.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | // AutoDeployReleaseOverride represents an auto-deploy release override. 4 | type AutoDeployReleaseOverride struct { 5 | EnvironmentID string `json:"EnvironmentId,omitempty"` 6 | ReleaseID string `json:"ReleaseId,omitempty"` 7 | TenantID string `json:"TenantId,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/projects/conversion_state.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ConversionState struct { 4 | VariablesAreInGit bool 5 | } 6 | 7 | func NewConversionState(variablesAreInGit bool) *ConversionState { 8 | return &ConversionState{ 9 | VariablesAreInGit: variablesAreInGit, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pkg/projects/convert_to_vcs.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ConvertToVcs struct { 4 | CommitMessage string `json:"CommitMessage"` 5 | VersionControlSettings GitPersistenceSettings `json:"VersionControlSettings"` 6 | InitialCommitBranchName string `json:"InitialCommitBranchName,omitempty"` 7 | } 8 | 9 | // NewConvertToVcs returns the new structure to send to Octopus to convert a project to VCS. 10 | // Will return error if initialCommitBranchName not explicitly specified and 11 | // the default branch is listed in the protected branch patterns. 12 | func NewConvertToVcs(commitMessage string, initialCommitBranchName string, gitPersistenceSettings GitPersistenceSettings) *ConvertToVcs { 13 | c := &ConvertToVcs{ 14 | CommitMessage: commitMessage, 15 | VersionControlSettings: gitPersistenceSettings, 16 | InitialCommitBranchName: initialCommitBranchName, 17 | } 18 | 19 | return c 20 | } 21 | -------------------------------------------------------------------------------- /pkg/projects/convert_to_vcs_response.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ConvertToVcsResponse struct { 4 | Messages []string 5 | } 6 | -------------------------------------------------------------------------------- /pkg/projects/database_persistence_settings.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | // DatabasePersistenceSettings represents database persistence settings associated with a project. 4 | type DatabasePersistenceSettings interface { 5 | PersistenceSettings 6 | } 7 | 8 | type databasePersistenceSettings struct { 9 | persistenceSettings 10 | } 11 | 12 | // NewDatabasePersistenceSettings creates an instance of database persistence settings. 13 | func NewDatabasePersistenceSettings() DatabasePersistenceSettings { 14 | return &databasePersistenceSettings{ 15 | persistenceSettings: persistenceSettings{SettingsType: PersistenceSettingsTypeDatabase}, 16 | } 17 | } 18 | 19 | // Type returns the type for this persistence settings. 20 | func (d databasePersistenceSettings) Type() PersistenceSettingsType { 21 | return d.SettingsType 22 | } 23 | 24 | var _ DatabasePersistenceSettings = &databasePersistenceSettings{} 25 | -------------------------------------------------------------------------------- /pkg/projects/is_nil.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Project: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/projects/persistence_settings.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | // PersistenceSettings defines the interface for persistence settings. 4 | type PersistenceSettings interface { 5 | Type() PersistenceSettingsType 6 | } 7 | 8 | // persistenceSettings represents persistence settings associated with a project. 9 | type persistenceSettings struct { 10 | SettingsType PersistenceSettingsType `json:"Type"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/projects/persistence_settings_types.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type PersistenceSettingsType string 4 | 5 | const ( 6 | PersistenceSettingsTypeDatabase = PersistenceSettingsType("Database") 7 | PersistenceSettingsTypeVersionControlled = PersistenceSettingsType("VersionControlled") 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/projects/project_branches.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type CreateBranchRequest struct { 4 | BaseGitRef string `json:"BaseGitRef"` 5 | NewBranchName string `json:"NewBranchName"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/projects/project_clone_request.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ProjectCloneRequest struct { 4 | Name string `json:"Name"` 5 | Description string `json:"Description"` 6 | ProjectGroupID string `json:"ProjectGroupID"` 7 | LifecycleID string `json:"LifecycleID"` 8 | } 9 | 10 | type ProjectCloneQuery struct { 11 | CloneProjectID string `uri:"clone" url:"clone"` 12 | } 13 | -------------------------------------------------------------------------------- /pkg/projects/project_pulse_query.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ProjectPulseQuery struct { 4 | ProjectIDs []string `uri:"projectIds,omitempty" url:"projectIds,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/projects/project_summary.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ProjectSummary struct { 4 | HasDeploymentProcess bool `json:"HasDeploymentProcess"` 5 | HasRunbooks bool `json:"HasRunbooks"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/projects/projects_experimental_summaries_query.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ProjectsExperimentalSummariesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/projects/projects_query.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | type ProjectsQuery struct { 4 | ClonedFromProjectID string `uri:"clonedFromProjectId,omitempty" url:"clonedFromProjectId,omitempty"` 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | IsClone bool `uri:"clone,omitempty" url:"clone,omitempty"` 7 | Name string `uri:"name,omitempty" url:"name,omitempty"` 8 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 9 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 10 | Take int `uri:"take,omitempty" url:"take,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/projects/release_creation_strategy.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages" 4 | 5 | type ReleaseCreationStrategy struct { 6 | ChannelID string `json:"ChannelId,omitempty"` 7 | ReleaseCreationPackage *packages.DeploymentActionPackage `json:"ReleaseCreationPackage,omitempty"` 8 | ReleaseCreationPackageStepID string `json:"ReleaseCreationPackageStepId,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/projects/versioning_strategy.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages" 4 | 5 | type VersioningStrategy struct { 6 | DonorPackage *packages.DeploymentActionPackage `json:"DonorPackage,omitempty"` 7 | DonorPackageStepID *string `json:"DonorPackageStepId,omitempty"` 8 | Template string `json:"Template,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/proxies/proxies_query.go: -------------------------------------------------------------------------------- 1 | package proxies 2 | 3 | type ProxiesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/releases/is_nil.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Release: 6 | return v == nil 7 | case *ReleaseQuery: 8 | return v == nil 9 | case *ReleasesQuery: 10 | return v == nil 11 | default: 12 | return v == nil 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pkg/releases/missing_package_info.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | type MissingPackages struct { 4 | Packages []MissingPackageInfo `json:"Packages"` 5 | } 6 | 7 | type MissingPackageInfo struct { 8 | ID string `json:"Id,omitempty"` 9 | Version string `json:"Version,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/releases/release_changes.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/issuetrackers" 6 | ) 7 | 8 | type ReleaseChanges struct { 9 | BuildInformation []*ReleasePackageVersionBuildInformation `json:"BuildInformation"` 10 | Commits []*issuetrackers.CommitDetails `json:"Commits"` 11 | ReleaseNotes string `json:"ReleaseNotes,omitempty"` 12 | Version string `json:"Version,omitempty"` 13 | WorkItems []*core.WorkItemLink `json:"WorkItems"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/releases/release_query.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | type ReleaseQuery struct { 4 | SearchByVersion string `uri:"searchByVersion" url:"searchByVersion,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/releases/release_template_git_resource.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/actions" 4 | 5 | type ReleaseTemplateGitResource struct { 6 | ActionName string `json:"ActionName,omitempty"` 7 | RepositoryUri string `json:"RepositoryUri,omitempty"` 8 | DefaultBranch string `json:"DefaultBranch,omitempty"` 9 | IsResolvable bool `json:"IsResolvable"` 10 | Name string `json:"Name,omitempty"` 11 | FilePathFilters []string `json:"FilePathFilters,omitempty"` 12 | GitCredentialId string `json:"NuGetPackageId,omitempty"` 13 | GitResourceSelectedLastRelease actions.VersionControlReference `json:"GitResourceSelectedLastRelease,omitempty"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/releases/release_usage.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | type ReleaseUsage struct { 4 | ProjectID string `json:"ProjectId,omitempty"` 5 | ProjectName string `json:"ProjectName,omitempty"` 6 | Releases []*ReleaseUsageEntry `json:"Releases"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/releases/release_usage_entry.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | type ReleaseUsageEntry struct { 4 | ReleaseID string `json:"ReleaseId,omitempty"` 5 | ReleaseVersion string `json:"ReleaseVersion,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/releases/releases_query.go: -------------------------------------------------------------------------------- 1 | package releases 2 | 3 | type ReleasesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | IgnoreChannelRules bool `uri:"ignoreChannelRules,omitempty" url:"ignoreChannelRules,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/reporting/reporting_service.go: -------------------------------------------------------------------------------- 1 | package reporting 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type ReportingService struct { 10 | deploymentsCountedByWeekPath string 11 | 12 | services.Service 13 | } 14 | 15 | func NewReportingService(sling *sling.Sling, uriTemplate string, deploymentsCountedByWeekPath string) *ReportingService { 16 | return &ReportingService{ 17 | deploymentsCountedByWeekPath: deploymentsCountedByWeekPath, 18 | Service: services.NewService(constants.ServiceReportingService, sling, uriTemplate), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/resources/interfaces.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | type IHasName interface { 4 | GetName() string 5 | SetName(string) 6 | } 7 | 8 | type IHasSpace interface { 9 | GetSpaceID() string 10 | SetSpaceID(string) 11 | } 12 | -------------------------------------------------------------------------------- /pkg/resources/links.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | type Links struct { 4 | Self string `json:"Self"` 5 | Template string `json:"Template"` 6 | PageAll string `json:"Page.All"` 7 | PageCurrent string `json:"Page.Current"` 8 | PageLast string `json:"Page.Last"` 9 | PageNext string `json:"Page.Next"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/resources/paged_results.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | type PagedResults struct { 4 | ItemsPerPage int `json:"ItemsPerPage"` 5 | ItemType string `json:"ItemType"` 6 | LastPageNumber int `json:"LastPageNumber"` 7 | Links Links `json:"Links"` 8 | NumberOfPages int `json:"NumberOfPages"` 9 | TotalResults int `json:"TotalResults"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/resources/process_reference_data_item.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | type ProcessReferenceDataItem struct { 4 | ID string `json:"Id,omitempty"` 5 | Name string `json:"Name,omitempty"` 6 | ProcessType string `json:"ProcessType,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/resources/reference_data_item.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | type ReferenceDataItem struct { 4 | ID string `json:"Id,omitempty"` 5 | Name string `json:"Name,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/resources/resource_test.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | type testExampleWithResource struct { 10 | Resource 11 | } 12 | 13 | func TestResourceEmbedding(t *testing.T) { 14 | example := &testExampleWithResource{} 15 | 16 | assert.Empty(t, example.GetID()) 17 | assert.Empty(t, example.GetModifiedBy()) 18 | assert.Empty(t, example.GetModifiedOn()) 19 | assert.Empty(t, example.GetLinks()) 20 | 21 | example.ID = "id-value" 22 | 23 | assert.Equal(t, "id-value", example.GetID()) 24 | } 25 | -------------------------------------------------------------------------------- /pkg/runbookprocess/runbook_process.go: -------------------------------------------------------------------------------- 1 | package runbookprocess 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | type RunbookProcess struct { 9 | LastSnapshotID string `json:"LastSnapshotId,omitempty"` 10 | ProjectID string `json:"ProjectId,omitempty"` 11 | RunbookID string `json:"RunbookId,omitempty"` 12 | SpaceID string `json:"SpaceId,omitempty"` 13 | Steps []*deployments.DeploymentStep `json:"Steps"` 14 | Version *int32 `json:"Version"` 15 | 16 | resources.Resource 17 | } 18 | 19 | func NewRunbookProcess() *RunbookProcess { 20 | return &RunbookProcess{ 21 | Resource: *resources.NewResource(), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pkg/runbookprocess/runbook_process_service.go: -------------------------------------------------------------------------------- 1 | package runbookprocess 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/newclient" 5 | ) 6 | 7 | const template = "/api/{spaceId}/runbookProcesses{/id}{?skip,take,ids}" 8 | 9 | // GetByID returns the runbook process that matches the input ID. If one cannot 10 | // be found, it returns nil and an error. 11 | func GetByID(client newclient.Client, spaceID string, ID string) (*RunbookProcess, error) { 12 | return newclient.GetByID[RunbookProcess](client, template, spaceID, ID) 13 | } 14 | 15 | // Update modifies a runbook process based on the one provided as input. 16 | func Update(client newclient.Client, runbook *RunbookProcess) (*RunbookProcess, error) { 17 | return newclient.Update[RunbookProcess](client, template, runbook.SpaceID, runbook.ID, runbook) 18 | } 19 | -------------------------------------------------------------------------------- /pkg/runbooks/is_nil.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Runbook: 6 | return v == nil 7 | case *RunbookSnapshot: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/runbooks/run_preview.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments" 5 | ) 6 | 7 | type RunPreview struct { 8 | Form *deployments.Form `json:"Form,omitempty"` 9 | StepsToExecute []*deployments.DeploymentTemplateStep `json:"StepsToExecute,omitempty"` 10 | UseGuidedFailureModeByDefault bool `json:"UseGuidedFailureModeByDefault"` 11 | } 12 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_process.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | type RunbookProcess struct { 9 | LastSnapshotID string `json:"LastSnapshotId,omitempty"` 10 | ProjectID string `json:"ProjectId,omitempty"` 11 | RunbookID string `json:"RunbookId,omitempty"` 12 | SpaceID string `json:"SpaceId,omitempty"` 13 | Steps []*deployments.DeploymentStep `json:"Steps"` 14 | Version *int32 `json:"Version"` 15 | 16 | resources.Resource 17 | } 18 | 19 | func NewRunbookProcess() *RunbookProcess { 20 | return &RunbookProcess{ 21 | Resource: *resources.NewResource(), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_processes_query.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookProcessesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_retention_period.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookRetentionPeriod struct { 4 | QuantityToKeep int32 `json:"QuantityToKeep"` 5 | ShouldKeepForever bool `json:"ShouldKeepForever"` 6 | } 7 | 8 | func NewRunbookRetentionPeriod() *RunbookRetentionPeriod { 9 | return &RunbookRetentionPeriod{ 10 | QuantityToKeep: 100, 11 | ShouldKeepForever: false, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_run_service.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type RunbookRunService struct { 10 | services.CanDeleteService 11 | } 12 | 13 | func NewRunbookRunService(sling *sling.Sling, uriTemplate string) *RunbookRunService { 14 | return &RunbookRunService{ 15 | CanDeleteService: services.CanDeleteService{ 16 | Service: services.NewService(constants.ServiceRunbookRunService, sling, uriTemplate), 17 | }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_runs_query.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookRunsQuery struct { 4 | Environments []string `uri:"environments,omitempty" url:"environments,omitempty"` 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Projects []string `uri:"projects,omitempty" url:"projects,omitempty"` 8 | Runbooks []string `uri:"runbooks,omitempty" url:"runbooks,omitempty"` 9 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 10 | Take int `uri:"take,omitempty" url:"take,omitempty"` 11 | TaskState string `uri:"taskState,omitempty" url:"taskState,omitempty"` 12 | Tenants []string `uri:"tenants,omitempty" url:"tenants,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_snapshot_query.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookSnapshotsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Publish bool `uri:"publish,omitempty" url:"publish,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_snapshot_template.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/releases" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 6 | ) 7 | 8 | type RunbookSnapshotTemplate struct { 9 | NextNameIncrement string `json:"NextNameIncrement,omitempty"` 10 | Packages []*releases.ReleaseTemplatePackage `json:"Packages"` 11 | GitResources []releases.ReleaseTemplateGitResource `json:"GitResources,omitempty"` 12 | RunbookID string `json:"RunbookId,omitempty"` 13 | RunbookProcessID string `json:"RunbookProcessId,omitempty"` 14 | 15 | resources.Resource 16 | } 17 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_snapshot_usage.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookSnapshotUsage struct { 4 | ProjectID string `json:"ProjectId,omitempty"` 5 | ProjectName string `json:"ProjectName,omitempty"` 6 | RunbookID string `json:"RunbookId,omitempty"` 7 | RunbookName string `json:"RunbookName,omitempty"` 8 | Snapshots []*RunbookSnapshotUsageEntry `json:"Snapshots"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_snapshot_usage_entry.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbookSnapshotUsageEntry struct { 4 | SnapshotID string `json:"SnapshotId,omitempty"` 5 | SnapshotName string `json:"SnapshotName,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/runbooks/runbook_step_usage.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments" 4 | 5 | type RunbookStepUsage struct { 6 | ProcessID string `json:"ProcessId,omitempty"` 7 | ProjectID string `json:"ProjectId,omitempty"` 8 | ProjectName string `json:"ProjectName,omitempty"` 9 | ProjectSlug string `json:"ProjectSlug,omitempty"` 10 | RunbookID string `json:"RunbookId,omitempty"` 11 | RunbookName string `json:"RunbookName,omitempty"` 12 | Steps []*deployments.StepUsageEntry `json:"Steps"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/runbooks/runbooks_query.go: -------------------------------------------------------------------------------- 1 | package runbooks 2 | 3 | type RunbooksQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | IsClone bool `uri:"clone,omitempty" url:"clone,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | ProjectIDs []string `uri:"projectIds,omitempty" url:"projectIds,omitempty"` 8 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/scheduler/scheduler_query.go: -------------------------------------------------------------------------------- 1 | package scheduler 2 | 3 | type SchedulerQuery struct { 4 | Verbose bool `uri:"verbose,omitempty" url:"verbose,omitempty"` 5 | Tail string `uri:"tail,omitempty" url:"tail,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/scheduler/scheduler_service.go: -------------------------------------------------------------------------------- 1 | package scheduler 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type SchedulerService struct { 10 | services.Service 11 | } 12 | 13 | func NewSchedulerService(sling *sling.Sling, uriTemplate string) *SchedulerService { 14 | return &SchedulerService{ 15 | Service: services.NewService(constants.ServiceSchedulerService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/serverstatus/server_status.go: -------------------------------------------------------------------------------- 1 | package serverstatus 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type ServerStatus struct { 6 | IsDatabaseEncrypted bool `json:"IsDatabaseEncrypted"` 7 | IsMajorMinorUpgrade bool `json:"IsMajorMinorUpgrade"` 8 | IsInMaintenanceMode bool `json:"IsInMaintenanceMode"` 9 | IsUpgradeAvailable bool `json:"IsUpgradeAvailable"` 10 | MaintenanceExpires string `json:"MaintenanceExpires,omitempty"` 11 | MaximumAvailableVersion string `json:"MaximumAvailableVersion,omitempty"` 12 | MaximumAvailableVersionCoveredByLicense string `json:"MaximumAvailableVersionCoveredByLicense,omitempty"` 13 | 14 | resources.Resource 15 | } 16 | -------------------------------------------------------------------------------- /pkg/services/api/automation_environment_provider_test.go: -------------------------------------------------------------------------------- 1 | package api_test 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services/api" 5 | "github.com/stretchr/testify/assert" 6 | "testing" 7 | ) 8 | 9 | func TestGetAutomationEnvironment_None(t *testing.T) { 10 | e := api.NewMockEnvironment() 11 | result := api.GetAutomationEnvironment(e) 12 | assert.Equal(t, "NoneOrUnknown", result) 13 | } 14 | 15 | func TestGetAutomationEnvironment(t *testing.T) { 16 | e := api.NewMockEnvironment() 17 | e.Setenv("GITHUB_ACTIONS", "GITHUB_ACTIONS") 18 | result := api.GetAutomationEnvironment(e) 19 | assert.Equal(t, "GitHubActions", result) 20 | } 21 | 22 | func TestGetAutomationEnvironment_TeamCity(t *testing.T) { 23 | e := api.NewMockEnvironment() 24 | e.Setenv("TEAMCITY_VERSION", "2018.1.3 (Build 12345)") 25 | result := api.GetAutomationEnvironment(e) 26 | assert.Equal(t, "TeamCity/2018.1.3", result) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/services/api/environment.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import "os" 4 | 5 | type Environment interface { 6 | Getenv(key string) string 7 | } 8 | 9 | type OsEnvironment struct { 10 | } 11 | 12 | type MockEnvironment struct { 13 | values map[string]string 14 | } 15 | 16 | func NewMockEnvironment() *MockEnvironment { 17 | return &MockEnvironment{ 18 | values: make(map[string]string), 19 | } 20 | } 21 | 22 | func (e MockEnvironment) Getenv(key string) string { 23 | return e.values[key] 24 | } 25 | 26 | func (e MockEnvironment) Setenv(key string, value string) { 27 | e.values[key] = value 28 | } 29 | 30 | func (e OsEnvironment) Getenv(key string) string { 31 | return os.Getenv(key) 32 | } 33 | -------------------------------------------------------------------------------- /pkg/services/is_nil.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | func IsNil(i interface{}) bool { 6 | switch v := i.(type) { 7 | case resources.IResource: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/services/new_service_tests.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/uritemplates" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func NewServiceTests(t *testing.T, service IService, uriTemplate string, ServiceName string) { 11 | require.NotNil(t, service) 12 | require.NotNil(t, service.GetClient()) 13 | 14 | template, err := uritemplates.Parse(uriTemplate) 15 | require.NoError(t, err) 16 | require.Equal(t, service.GetURITemplate(), template) 17 | require.Equal(t, service.GetName(), ServiceName) 18 | } 19 | -------------------------------------------------------------------------------- /pkg/spaces/is_nil.go: -------------------------------------------------------------------------------- 1 | package spaces 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Space: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/spaces/space_home_query.go: -------------------------------------------------------------------------------- 1 | package spaces 2 | 3 | type SpaceHomeQuery struct { 4 | SpaceID string `uri:"spaceId,omitempty" url:"spaceId,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/spaces/spaces_query.go: -------------------------------------------------------------------------------- 1 | package spaces 2 | 3 | type SpacesQuery struct { 4 | IDs []string `uri:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty"` 7 | Take int `uri:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/subscriptions/subscription_service.go: -------------------------------------------------------------------------------- 1 | package subscriptions 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type SubscriptionService struct { 10 | services.CanDeleteService 11 | } 12 | 13 | func NewSubscriptionService(sling *sling.Sling, uriTemplate string) *SubscriptionService { 14 | return &SubscriptionService{ 15 | CanDeleteService: services.CanDeleteService{ 16 | Service: services.NewService(constants.ServiceSubscriptionService, sling, uriTemplate), 17 | }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/subscriptions/subscriptions_query.go: -------------------------------------------------------------------------------- 1 | package subscriptions 2 | 3 | type SubscriptionsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Spaces []string `uri:"spaces,omitempty" url:"spaces,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/tagsets/is_nil.go: -------------------------------------------------------------------------------- 1 | package tagsets 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *TagSet: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/tagsets/tag.go: -------------------------------------------------------------------------------- 1 | package tagsets 2 | 3 | type Tag struct { 4 | CanonicalTagName string `json:"CanonicalTagName,omitempty"` 5 | Color string `json:"Color"` 6 | Description string `json:"Description"` 7 | ID string `json:"Id,omitempty"` 8 | Name string `json:"Name"` 9 | SortOrder int `json:"SortOrder,omitempty"` 10 | } 11 | 12 | // NewTag initializes a tag with a name and a color. 13 | func NewTag(name string, color string) *Tag { 14 | return &Tag{ 15 | Color: color, 16 | Name: name, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pkg/tagsets/tag_set.go: -------------------------------------------------------------------------------- 1 | package tagsets 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type TagSet struct { 6 | Description string `json:"Description"` 7 | Name string `json:"Name"` 8 | SortOrder int32 `json:"SortOrder,omitempty"` 9 | SpaceID string `json:"SpaceId,omitempty"` 10 | Tags []*Tag `json:"Tags,omitempty"` 11 | 12 | resources.Resource 13 | } 14 | 15 | // NewTagSet initializes a TagSet with a name. 16 | func NewTagSet(name string) *TagSet { 17 | return &TagSet{ 18 | Name: name, 19 | Resource: *resources.NewResource(), 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pkg/tagsets/tag_sets_query.go: -------------------------------------------------------------------------------- 1 | package tagsets 2 | 3 | type TagSetsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/tasks/is_nil.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Task: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/teammembership/team_membership_service.go: -------------------------------------------------------------------------------- 1 | package teammembership 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type TeamMembershipService struct { 10 | previewTeamPath string 11 | 12 | services.Service 13 | } 14 | 15 | func NewTeamMembershipService(sling *sling.Sling, uriTemplate string, previewTeamPath string) *TeamMembershipService { 16 | return &TeamMembershipService{ 17 | previewTeamPath: previewTeamPath, 18 | Service: services.NewService(constants.ServiceTeamMembershipService, sling, uriTemplate), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/teams/is_nil.go: -------------------------------------------------------------------------------- 1 | package teams 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Team: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/teams/team_membership_query.go: -------------------------------------------------------------------------------- 1 | package teams 2 | 3 | type TeamMembershipQuery struct { 4 | IncludeSystem bool `uri:"includeSystem,omitempty" url:"includeSystem,omitempty"` 5 | Spaces []string `uri:"spaces,omitempty" url:"spaces,omitempty"` 6 | UserID string `uri:"userId,omitempty" url:"userId,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/teams/teams_query.go: -------------------------------------------------------------------------------- 1 | package teams 2 | 3 | type TeamsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | IncludeSystem bool `uri:"includeSystem,omitempty" url:"includeSystem,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Spaces []string `uri:"spaces,omitempty" url:"spaces,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/tenants/is_nil.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *Tenant: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/tenants/tenant_clone_request.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | type TenantCloneRequest struct { 4 | Name string `json:"Name"` 5 | Description string `json:"Description"` 6 | } 7 | 8 | type TenantCloneQuery struct { 9 | CloneTenantID string `uri:"clone" url:"clone"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/tenants/tenant_variables_query.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | type TenantVariablesQuery struct { 4 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/tenants/tenants_missing_variables_query.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | type TenantsMissingVariablesQuery struct { 4 | EnvironmentID []string `uri:"environmentId,omitempty" url:"environmentId,omitempty"` 5 | IncludeDetails bool `uri:"includeDetails,omitempty" url:"includeDetails,omitempty"` 6 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 7 | TenantID string `uri:"tenantId,omitempty" url:"tenantId,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/tenants/tenants_query.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | type TenantsQuery struct { 4 | ClonedFromTenantID string `uri:"clonedFromTenantId,omitempty" url:"clonedFromTenantId,omitempty"` 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | IsClone bool `uri:"clone,omitempty" url:"clone,omitempty"` 7 | IsDisabled bool `uri:"isDisabled,omitempty" url:"isDisabled,omitempty"` 8 | Name string `uri:"name,omitempty" url:"name,omitempty"` 9 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 10 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 11 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 12 | Tags []string `uri:"tags,omitempty" url:"tags,omitempty"` 13 | Take int `uri:"take,omitempty" url:"take,omitempty"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/triggers/is_nil.go: -------------------------------------------------------------------------------- 1 | package triggers 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *ProjectTrigger: 6 | return v == nil 7 | default: 8 | return v == nil 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pkg/triggers/project_triggers_query.go: -------------------------------------------------------------------------------- 1 | package triggers 2 | 3 | type ProjectTriggersQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Runbooks []string `uri:"runbooks,omitempty" url:"runbooks,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/triggers/scheduled_project_triggers_query.go: -------------------------------------------------------------------------------- 1 | package triggers 2 | 3 | type ScheduledProjectTriggersQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 6 | Take int `uri:"take,omitempty" url:"take,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/triggers/scheduled_project_triggers_service.go: -------------------------------------------------------------------------------- 1 | package triggers 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type ScheduledProjectTriggerService struct { 10 | services.Service 11 | } 12 | 13 | func NewScheduledProjectTriggerService(sling *sling.Sling, uriTemplate string) *ScheduledProjectTriggerService { 14 | return &ScheduledProjectTriggerService{ 15 | Service: services.NewService(constants.ServiceScheduledProjectTriggerService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/useronboarding/user_onboarding_service.go: -------------------------------------------------------------------------------- 1 | package useronboarding 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type UserOnboardingService struct { 10 | services.Service 11 | } 12 | 13 | func NewUserOnboardingService(sling *sling.Sling, uriTemplate string) *UserOnboardingService { 14 | return &UserOnboardingService{ 15 | Service: services.NewService(constants.ServiceUserOnboardingService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pkg/userroles/is_nil.go: -------------------------------------------------------------------------------- 1 | package userroles 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *ScopedUserRole: 6 | return v == nil 7 | case *UserRole: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/userroles/scoped_user_roles_query.go: -------------------------------------------------------------------------------- 1 | package userroles 2 | 3 | type ScopedUserRolesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | IncludeSystem bool `uri:"includeSystem,omitempty" url:"includeSystem,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Spaces []string `uri:"spaces,omitempty" url:"spaces,omitempty"` 9 | Take int `uri:"take,omitempty" url:"take,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/userroles/user_roles_query.go: -------------------------------------------------------------------------------- 1 | package userroles 2 | 3 | type UserRolesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/users/api_query.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type APIQuery struct { 4 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 5 | Take int `uri:"take,omitempty" url:"take,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/users/external_user_search_query.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type ExternalUserSearchQuery struct { 4 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/users/identity.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type Identity struct { 4 | Claims map[string]IdentityClaim `json:"Claims,omitempty"` 5 | IdentityProviderName string `json:"IdentityProviderName,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/users/identity_claim.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type IdentityClaim struct { 4 | IsIdentifyingClaim bool `json:"IsIdentifyingClaim"` 5 | Value string `json:"Value,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/users/is_nil.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *APIKey: 6 | return v == nil 7 | case *User: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/users/sign_in_query.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type SignInQuery struct { 4 | ReturnURL string `uri:"returnUrl,omitempty" url:"returnUrl,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/users/user_authentication.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/authentication" 4 | 5 | // UserAuthentication represents enabled authentication providers and whether 6 | // the current user can edit logins for the given user. 7 | type UserAuthentication struct { 8 | AuthenticationProviders []authentication.AuthenticationProviderElement 9 | CanCurrentUserEditIdentitiesForUser bool 10 | Links map[string]string 11 | } 12 | -------------------------------------------------------------------------------- /pkg/users/user_query.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type UserQuery struct { 4 | IncludeSystem bool `uri:"includeSystem,omitempty" url:"includeSystem,omitempty"` 5 | Spaces []string `uri:"spaces,omitempty" url:"spaces,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /pkg/users/users_query.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | type UsersQuery struct { 4 | Filter string `uri:"filter,omitempty" url:"filter,omitempty"` 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 7 | Take int `uri:"take,omitempty" url:"take,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/validation/not_all_validator.go: -------------------------------------------------------------------------------- 1 | package validation 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | 7 | "github.com/go-playground/validator/v10" 8 | ) 9 | 10 | // NotAll is the validation function for validating if the current field has a 11 | // value of "all". 12 | func NotAll(fl validator.FieldLevel) bool { 13 | field := fl.Field() 14 | 15 | if field.Kind() == reflect.String { 16 | return strings.ToLower(field.String()) != "all" 17 | } 18 | 19 | return true 20 | } 21 | -------------------------------------------------------------------------------- /pkg/variables/is_nil.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *LibraryVariableSetUsageEntry: 6 | return v == nil 7 | case *LibraryVariableSet: 8 | return v == nil 9 | case *ScriptModule: 10 | return v == nil 11 | default: 12 | return v == nil 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pkg/variables/library.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/actiontemplates" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 6 | ) 7 | 8 | type Library struct { 9 | LibraryVariableSetID string `json:"LibraryVariableSetId,omitempty"` 10 | LibraryVariableSetName string `json:"LibraryVariableSetName,omitempty"` 11 | Links map[string]string `json:"Links,omitempty"` 12 | Templates []*actiontemplates.ActionTemplateParameter `json:"Templates"` 13 | Variables map[string]core.PropertyValue `json:"Variables,omitempty"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/variables/library_variable.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/actiontemplates" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 6 | ) 7 | 8 | type LibraryVariable struct { 9 | LibraryVariableSetID string `json:"LibraryVariableSetId,omitempty"` 10 | LibraryVariableSetName string `json:"LibraryVariableSetName,omitempty"` 11 | Links map[string]string `json:"Links,omitempty"` 12 | Templates []*actiontemplates.ActionTemplateParameter `json:"Templates"` 13 | Variables map[string]core.PropertyValue `json:"Variables,omitempty"` 14 | } 15 | 16 | func NewLibraryVariable() *LibraryVariable { 17 | return &LibraryVariable{ 18 | Links: map[string]string{}, 19 | Variables: map[string]core.PropertyValue{}, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pkg/variables/library_variable_set_usage_entry.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type LibraryVariableSetUsageEntry struct { 6 | LibraryVariableSetID string `json:"LibraryVariableSetId,omitempty"` 7 | LibraryVariableSetName string `json:"LibraryVariableSetName,omitempty"` 8 | 9 | resources.Resource 10 | } 11 | 12 | func NewLibraryVariableSetUsageEntry() *LibraryVariableSetUsageEntry { 13 | return &LibraryVariableSetUsageEntry{ 14 | Resource: *resources.NewResource(), 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pkg/variables/library_variables_query.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type LibraryVariablesQuery struct { 4 | ContentType string `uri:"contentType,omitempty" url:"contentType,omitempty"` 5 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/variables/missing_variable.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type MissingVariable struct { 4 | EnvironmentID string `json:"EnvironmentId,omitempty"` 5 | LibraryVariableSetID string `json:"LibraryVariableSetId,omitempty"` 6 | Links map[string]string `json:"Links,omitempty"` 7 | ProjectID string `json:"ProjectId,omitempty"` 8 | VariableTemplateID string `json:"VariableTemplateId,omitempty"` 9 | VariableTemplateName string `json:"VariableTemplateName,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/variables/missing_variables_query.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type MissingVariablesQuery struct { 4 | EnvironmentID string `uri:"environmentId,omitempty" url:"environmentId,omitempty"` 5 | IncludeDetails bool `uri:"includeDetails,omitempty" url:"includeDetails,omitempty"` 6 | ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"` 7 | TenantID string `uri:"tenantId,omitempty" url:"tenantId,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /pkg/variables/project_variable.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/actiontemplates" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" 6 | ) 7 | 8 | type ProjectVariable struct { 9 | Links map[string]string `json:"Links,omitempty"` 10 | ProjectID string `json:"ProjectId,omitempty"` 11 | ProjectName string `json:"ProjectName,omitempty"` 12 | Templates []*actiontemplates.ActionTemplateParameter `json:"Templates"` 13 | Variables map[string]map[string]core.PropertyValue `json:"Variables,omitempty"` 14 | } 15 | -------------------------------------------------------------------------------- /pkg/variables/project_variable_set_usage.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/releases" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/runbooks" 6 | ) 7 | 8 | type ProjectVariableSetUsage struct { 9 | IsCurrentlyBeingUsedInProject bool `json:"IsCurrentlyBeingUsedInProject"` 10 | ProjectID string `json:"ProjectId,omitempty"` 11 | ProjectName string `json:"ProjectName,omitempty"` 12 | ProjectSlug string `json:"ProjectSlug,omitempty"` 13 | Releases []*releases.ReleaseUsageEntry `json:"Releases"` 14 | RunbookSnapshots []*runbooks.RunbookSnapshotUsageEntry `json:"RunbookSnapshots"` 15 | } 16 | -------------------------------------------------------------------------------- /pkg/variables/tenant_variable.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type TenantVariables struct { 6 | LibraryVariables map[string]LibraryVariable `json:"LibraryVariables,omitempty"` 7 | ProjectVariables map[string]ProjectVariable `json:"ProjectVariables,omitempty"` 8 | SpaceID string `json:"SpaceId,omitempty"` 9 | TenantID string `json:"TenantId,omitempty"` 10 | TenantName string `json:"TenantName,omitempty"` 11 | 12 | resources.Resource 13 | } 14 | 15 | func NewTenantVariables(tenantID string) *TenantVariables { 16 | return &TenantVariables{ 17 | TenantID: tenantID, 18 | Resource: *resources.NewResource(), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/variables/tenant_variable_scope.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type TenantVariableScope struct { 6 | EnvironmentIds []string `json:"EnvironmentIds"` 7 | 8 | resources.Resource 9 | } 10 | -------------------------------------------------------------------------------- /pkg/variables/tenant_variable_service.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services/api" 7 | "github.com/dghubble/sling" 8 | ) 9 | 10 | type TenantVariableService struct { 11 | services.Service 12 | } 13 | 14 | func NewTenantVariableService(sling *sling.Sling, uriTemplate string) *TenantVariableService { 15 | return &TenantVariableService{ 16 | Service: services.NewService(constants.ServiceTenantVariableService, sling, uriTemplate), 17 | } 18 | } 19 | 20 | func (s *TenantVariableService) GetAll() ([]TenantVariables, error) { 21 | items := []TenantVariables{} 22 | path, err := services.GetPath(s) 23 | if err != nil { 24 | return items, err 25 | } 26 | 27 | _, err = api.ApiGet(s.GetClient(), &items, path) 28 | return items, err 29 | } 30 | -------------------------------------------------------------------------------- /pkg/variables/tenants_missing_variables.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type TenantsMissingVariables struct { 4 | Links map[string]string `json:"Links,omitempty"` 5 | MissingVariables []MissingVariable `json:"MissingVariables,omitempty"` 6 | TenantID string `json:"TenantId,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/variables/variable.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type Variable struct { 6 | Description string `json:"Description"` 7 | IsEditable bool `json:"IsEditable"` 8 | IsSensitive bool `json:"IsSensitive"` 9 | Name string `json:"Name"` 10 | Prompt *VariablePromptOptions `json:"Prompt,omitempty"` 11 | Scope VariableScope `json:"Scope"` 12 | Type string `json:"Type"` 13 | Value string `json:"Value"` 14 | SpaceID string `json:"SpaceId,omitempty"` 15 | 16 | resources.Resource 17 | } 18 | 19 | func NewVariable(name string) *Variable { 20 | return &Variable{ 21 | IsEditable: true, 22 | IsSensitive: false, 23 | Name: name, 24 | Type: "String", 25 | 26 | Resource: *resources.NewResource(), 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/variables/variable_name_query.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type VariableNamesQuery struct { 4 | Project string `uri:"project,omitempty" url:"project,omitempty"` 5 | ProjectEnvironmentsFilter string `uri:"projectEnvironmentsFilter,omitempty" url:"projectEnvironmentsFilter,omitempty"` 6 | Runbook string `uri:"runbook,omitempty" url:"runbook,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /pkg/variables/variable_preview_query.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type VariablePreviewQuery struct { 4 | Action string `uri:"action,omitempty" url:"action,omitempty"` 5 | Channel string `uri:"channel,omitempty" url:"channel,omitempty"` 6 | Environment string `uri:"environment,omitempty" url:"environment,omitempty"` 7 | Machine string `uri:"machine,omitempty" url:"machine,omitempty"` 8 | Project string `uri:"project,omitempty" url:"project,omitempty"` 9 | Role string `uri:"role,omitempty" url:"role,omitempty"` 10 | Runbook string `uri:"runbook,omitempty" url:"runbook,omitempty"` 11 | Tenant string `uri:"tenant,omitempty" url:"tenant,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /pkg/variables/variable_prompt_options.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type VariablePromptOptions struct { 6 | Description string `json:"Description"` 7 | DisplaySettings *resources.DisplaySettings `json:"DisplaySettings,omitempty"` 8 | IsRequired bool `json:"Required"` 9 | Label string `json:"Label"` 10 | } 11 | -------------------------------------------------------------------------------- /pkg/variables/variable_scope.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type VariableScope struct { 4 | Environments []string `json:"Environment,omitempty"` 5 | Machines []string `json:"Machine,omitempty"` 6 | Actions []string `json:"Action,omitempty"` 7 | Roles []string `json:"Role,omitempty"` 8 | Channels []string `json:"Channel,omitempty"` 9 | TenantTags []string `json:"TenantTag,omitempty"` 10 | ProcessOwners []string `json:"ProcessOwner,omitempty"` 11 | } 12 | 13 | func (scope VariableScope) IsEmpty() bool { 14 | return len(scope.Actions) == 0 && 15 | len(scope.Channels) == 0 && 16 | len(scope.Environments) == 0 && 17 | len(scope.Machines) == 0 && 18 | len(scope.Roles) == 0 && 19 | len(scope.TenantTags) == 0 && 20 | len(scope.ProcessOwners) == 0 21 | } 22 | -------------------------------------------------------------------------------- /pkg/variables/variable_scope_values.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type VariableScopeValues struct { 6 | Actions []*resources.ReferenceDataItem `json:"Actions"` 7 | Channels []*resources.ReferenceDataItem `json:"Channels"` 8 | Environments []*resources.ReferenceDataItem `json:"Environments"` 9 | Machines []*resources.ReferenceDataItem `json:"Machines"` 10 | Processes []*resources.ProcessReferenceDataItem `json:"Processes"` 11 | Roles []*resources.ReferenceDataItem `json:"Roles"` 12 | TenantTags []*resources.ReferenceDataItem `json:"TenantTags"` 13 | } 14 | -------------------------------------------------------------------------------- /pkg/variables/variable_set.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | import "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources" 4 | 5 | type VariableSet struct { 6 | OwnerID string `json:"OwnerId,omitempty"` 7 | ScopeValues *VariableScopeValues `json:"ScopeValues,omitempty"` 8 | SpaceID string `json:"SpaceId,omitempty"` 9 | Variables []*Variable `json:"Variables"` 10 | Version int32 `json:"Version"` 11 | 12 | resources.Resource 13 | } 14 | 15 | func NewVariableSet() *VariableSet { 16 | return &VariableSet{ 17 | Resource: *resources.NewResource(), 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pkg/variables/variables_query.go: -------------------------------------------------------------------------------- 1 | package variables 2 | 3 | type VariablesQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | } 6 | -------------------------------------------------------------------------------- /pkg/workerpools/dynamic_worker_pool_type_resource.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | import "time" 4 | 5 | type DynamicWorkerPoolTypes struct { 6 | ID string `json:"Id"` 7 | WorkerTypes []*DynamicWorkerPoolType `json:"WorkerTypes"` 8 | } 9 | 10 | type DynamicWorkerPoolType struct { 11 | ID string `json:"Id"` 12 | Type string `json:"Type"` 13 | Description string `json:"Description"` 14 | DeprecationDateUtc *time.Time `json:"DeprecationDateUtc"` 15 | EndOfLifeDateUtc *time.Time `json:"EndOfLifeDateUtc"` 16 | StartDateUtc *time.Time `json:"StartDateUtc"` 17 | } 18 | -------------------------------------------------------------------------------- /pkg/workerpools/is_nil.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | func IsNil(i interface{}) bool { 4 | switch v := i.(type) { 5 | case *WorkerPoolResource: 6 | return v == nil 7 | case IWorkerPool: 8 | return v == nil 9 | default: 10 | return v == nil 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pkg/workerpools/static_worker_pool.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | import ( 4 | "github.com/go-playground/validator/v10" 5 | "github.com/go-playground/validator/v10/non-standard/validators" 6 | ) 7 | 8 | type StaticWorkerPool struct { 9 | workerPool 10 | } 11 | 12 | // NewStaticWorkerPool creates and initializes a static worker pool. 13 | func NewStaticWorkerPool(name string) *StaticWorkerPool { 14 | return &StaticWorkerPool{ 15 | workerPool: *newWorkerPool(name, WorkerPoolTypeStatic), 16 | } 17 | } 18 | 19 | // Validate checks the state of the static worker pool and returns an error if 20 | // invalid. 21 | func (s *StaticWorkerPool) Validate() error { 22 | v := validator.New() 23 | err := v.RegisterValidation("notblank", validators.NotBlank) 24 | if err != nil { 25 | return err 26 | } 27 | return v.Struct(s) 28 | } 29 | -------------------------------------------------------------------------------- /pkg/workerpools/worker_pool_types.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | type WorkerPoolType string 4 | 5 | const ( 6 | WorkerPoolTypeDynamic WorkerPoolType = "DynamicWorkerPool" 7 | WorkerPoolTypeStatic WorkerPoolType = "StaticWorkerPool" 8 | ) 9 | -------------------------------------------------------------------------------- /pkg/workerpools/worker_pools_query.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | type WorkerPoolsQuery struct { 4 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 5 | Name string `uri:"name,omitempty" url:"name,omitempty"` 6 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 7 | Skip int `uri:"skip,omitempty" url:"skip,omitempty"` 8 | Take int `uri:"take,omitempty" url:"take,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /pkg/workerpools/worker_pools_summary_query.go: -------------------------------------------------------------------------------- 1 | package workerpools 2 | 3 | type WorkerPoolsSummaryQuery struct { 4 | CommunicationStyles []string `uri:"commStyles,omitempty" url:"commStyles,omitempty"` 5 | HealthStatuses []string `uri:"healthStatuses,omitempty" url:"healthStatuses,omitempty"` 6 | HideEmptyWorkerPools bool `uri:"hideEmptyWorkerPools,omitempty" url:"hideEmptyWorkerPools,omitempty"` 7 | IDs []string `uri:"ids,omitempty" url:"ids,omitempty"` 8 | IsDisabled bool `uri:"isDisabled,omitempty" url:"isDisabled,omitempty"` 9 | MachinePartialName string `uri:"machinePartialName,omitempty" url:"machinePartialName,omitempty"` 10 | PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"` 11 | ShellNames []string `uri:"shellNames,omitempty" url:"shellNames,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /pkg/workertoolslatestimages/worker_tools_latest_images_service.go: -------------------------------------------------------------------------------- 1 | package workertoolslatestimages 2 | 3 | import ( 4 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/constants" 5 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/services" 6 | "github.com/dghubble/sling" 7 | ) 8 | 9 | type WorkerToolsLatestImageService struct { 10 | services.Service 11 | } 12 | 13 | func NewWorkerToolsLatestImageService(sling *sling.Sling, uriTemplate string) *WorkerToolsLatestImageService { 14 | return &WorkerToolsLatestImageService{ 15 | Service: services.NewService(constants.ServiceWorkerToolsLatestImageService, sling, uriTemplate), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/e2e/configuration_service_test.go: -------------------------------------------------------------------------------- 1 | package e2e 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestGetConfiguration(t *testing.T) { 10 | octopusClient := getOctopusClient() 11 | 12 | configurationSection, err := octopusClient.Configuration.GetByID("authentication") 13 | 14 | assert.NoError(t, err) 15 | assert.NotNil(t, configurationSection) 16 | 17 | if err != nil || configurationSection == nil { 18 | return 19 | } 20 | 21 | assert.NotEmpty(t, configurationSection.Links) 22 | assert.NotEmpty(t, configurationSection.Links["Values"]) 23 | assert.NotEmpty(t, configurationSection.Links["Metadata"]) 24 | } 25 | -------------------------------------------------------------------------------- /test/e2e/server_status_service_test.go: -------------------------------------------------------------------------------- 1 | package e2e 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestServerStatusServiceGet(t *testing.T) { 10 | client := getOctopusClient() 11 | require.NotNil(t, client) 12 | 13 | serverStatus, err := client.ServerStatus.Get() 14 | require.NoError(t, err) 15 | require.NotNil(t, serverStatus) 16 | } 17 | -------------------------------------------------------------------------------- /test/resources/channel_test.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/internal" 7 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/channels" 8 | "github.com/stretchr/testify/assert" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestEmptyChannel(t *testing.T) { 13 | channel := &channels.Channel{} 14 | assert.Error(t, channel.Validate()) 15 | } 16 | 17 | func TestChannelWithName(t *testing.T) { 18 | name := internal.GetRandomName() 19 | channel := &channels.Channel{Name: name} 20 | assert.Error(t, channel.Validate()) 21 | } 22 | 23 | func TestNewChannelWithEmptyName(t *testing.T) { 24 | projectID := internal.GetRandomName() 25 | 26 | channel := channels.NewChannel("", projectID) 27 | require.Error(t, channel.Validate()) 28 | 29 | channel = channels.NewChannel(" ", projectID) 30 | require.Error(t, channel.Validate()) 31 | } 32 | -------------------------------------------------------------------------------- /test/resources/not_all_validator_test.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/validation" 7 | "github.com/go-playground/validator/v10" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | type NotAllTestStruct struct { 12 | Name string `validate:"notall"` 13 | } 14 | 15 | func TestNotAllValidation(t *testing.T) { 16 | notAll := &NotAllTestStruct{ 17 | Name: "All", 18 | } 19 | 20 | v := validator.New() 21 | 22 | err := v.RegisterValidation("notall", validation.NotAll) 23 | require.NoError(t, err) 24 | 25 | err = v.Struct(notAll) 26 | require.Error(t, err) 27 | 28 | notAll.Name = "all" 29 | 30 | err = v.Struct(notAll) 31 | require.Error(t, err) 32 | 33 | notAll.Name = "ALL" 34 | 35 | err = v.Struct(notAll) 36 | require.Error(t, err) 37 | 38 | notAll.Name = "aLl" 39 | 40 | err = v.Struct(notAll) 41 | require.Error(t, err) 42 | } 43 | -------------------------------------------------------------------------------- /test/resources/task_test.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/tasks" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestNewTask(t *testing.T) { 11 | task := tasks.NewTask() 12 | require.NotNil(t, task) 13 | require.NotNil(t, task.Arguments) 14 | } 15 | -------------------------------------------------------------------------------- /test/resources/variable_scope_test.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/variables" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestVariableScope(t *testing.T) { 11 | variableScope := variables.VariableScope{} 12 | assert.Nil(t, variableScope.Actions) 13 | assert.Len(t, variableScope.Actions, 0) 14 | } 15 | 16 | func TestVariableScopeIsEmpty(t *testing.T) { 17 | variableScope := variables.VariableScope{} 18 | assert.True(t, variableScope.IsEmpty()) 19 | 20 | variableScope.Actions = nil 21 | assert.True(t, variableScope.IsEmpty()) 22 | 23 | variableScope.Actions = []string{} 24 | assert.True(t, variableScope.IsEmpty()) 25 | 26 | variableScope.Actions = []string{"foo"} 27 | assert.False(t, variableScope.IsEmpty()) 28 | 29 | variableScope.Actions = []string{} 30 | assert.True(t, variableScope.IsEmpty()) 31 | } 32 | -------------------------------------------------------------------------------- /tests/Create-ApiKey.ps1: -------------------------------------------------------------------------------- 1 | . $PSScriptRoot\Octopus.ps1 2 | 3 | Wait-ForOctopus 4 | 5 | #Creating a connection 6 | $repository = Connect-ToOctopus "http://localhost:8080" 7 | 8 | #Creating login object 9 | $LoginObj = New-Object Octopus.Client.Model.LoginCommand 10 | $LoginObj.Username = "admin" 11 | $LoginObj.Password = "Password01!" 12 | 13 | #Loging in to Octopus 14 | $repository.Users.SignIn($LoginObj) 15 | 16 | #Getting current user logged in 17 | $UserObj = $repository.Users.GetCurrent() 18 | 19 | #Creating API Key for user. This automatically gets saved to the database. 20 | $ApiObj = $repository.Users.CreateApiKey($UserObj, "go-octopusdeploy tests") 21 | 22 | #Save the API key so we can use it later 23 | Set-Content -Path tests\octopus_api.txt -Value $ApiObj.ApiKey 24 | 25 | echo "OCTOPUS_APIKEY=$($ApiObj.ApiKey)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append --------------------------------------------------------------------------------