setIdentifier('swift') ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift') ->setText($l->t('OpenStack Object Storage')) ->addParameters([ (new DefinitionParameter('service_name', $l->t('Service name'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), new DefinitionParameter('region', $l->t('Region')), new DefinitionParameter('bucket', $l->t('Bucket')), (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), ]) ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK) ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) { if (isset($params['options']['key']) && $params['options']['key']) { return $rackspaceAuth; } return $openstackAuth; }) ; } }